HDU - 1235 統計同成績學生人數 桶排序
http://acm.hdu.edu.cn/showproblem.php?pid=1235
#include<iostream> #include<cstring> using namespace std; int a[101]; int main(){ int n; while(scanf("%d",&n)!=EOF && n ){ memset(a,0,sizeof(a)); int f,x; for(int i=0;i<n;i++){ scanf("%d",&x); a[x]++; } scanf("%d",&f); printf("%d\n",a[f]); } }
tips:
1.多組資料,記得清空陣列!!!
相關推薦
HDU - 1235 統計同成績學生人數 桶排序
http://acm.hdu.edu.cn/showproblem.php?pid=1235 #include<iostream> #include<cstring> using namespace std; int a[101]; int main(){ int n;
【HDU-1235】 統計同成績學生人數
統計同成績學生人數 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) To
題目1018:統計同成績學生人數(數組或者map)
result ble tdi core %d github col targe map 題目鏈接:http://ac.jobdu.com/problem.php?pid=1018 詳解鏈接:https://github.com/zpfbuaa/JobduInCPlusPl
TOJ1301: 統計同成績學生人數
malloc 統計同成績學生人數 () erro str pre 空間 for n! #include<iostream> using namespace std; int main() { int N; int a[1000];
HDOJ_1235_統計同成績學生人數
clas fclose spa 成績 cst return esp lose std AC代碼: #include <iostream> #include <cstdio> #define Max 1005 using namespace std;
1038. 統計同成績學生(20)
初始化 pre string 超過 一個 統計 col 分數 return 本題要求讀入N名學生的成績,將獲得某一給定分數的學生人數輸出。 輸入格式: 輸入在第1行給出不超過105的正整數N,即學生總人數。隨後1行給出N名學生的百分制整數成績,中間以空格分隔。最後1行給出要
【PAT】B1038 統計同成績學生(20)(20 分)
自己的 code return scanf pre pat can 學生 include #include<stdio.h> int arr[102]={0};//分數作為自己的下標,註意 int main(){ int N;scanf("%d",&am
PAT乙級 1038 統計同成績學生
本題要求讀入 N 名學生的成績,將獲得某一給定分數的學生人數輸出。 輸入格式: 輸入在第 1 行給出不超過 105的正整數 N,即學生總人數。隨後一行給出 N 名學生的百分制整數成績,中間以空格分隔。最後一行給出要查詢的分數個數 K(不超過 N 的正整數),隨後是 K 個分數,中間以
1038 統計同成績學生 (20 分)
1038 統計同成績學生 (20 分) 本題要求讀入 N 名學生的成績,將獲得某一給定分數的學生人數輸出。 輸入格式: 輸入在第 1 行給出不超過 105 的正整數 N,即學生總人數。隨後一行給出 N 名學生的百分制整數成績,中間以空格分隔。最後一行給出要查詢的分
PAT 統計同成績學生(乙級)
題目描述 本題要求讀入N名學生的成績,將獲得某一給定分數的學生人數輸出。 輸入描述: 輸入在第1行給出不超過105的正整數N,即學生總人數。隨後1行給出N名學生的百分制整數成績,中間以空格分隔
PAT 1038. 統計同成績學生(20)
本題要求讀入N名學生的成績,將獲得某一給定分數的學生人數輸出。 輸入格式: 輸入在第1行給出不超過105的正整數N,即學生總人數。隨後1行給出N名學生的百分制整數成績,中間以空格分隔。最後1行給出要查詢的分數個數K(不超過N的正整數),隨後是K個分數,中間以空格分隔。
1038. 統計同成績學生
本題要求讀入N名學生的成績,將獲得某一給定分數的學生人數輸出。 輸入格式: 輸入在第1行給出不超過105的正整數N,即學生總人數。隨後1行給出N名學生的百分制整數成績,中間以空格分隔。最後1行給出要
B1038 統計同成績學生
用空間換時間,hash陣列的思想,原來正式名稱叫雜湊啊#include<cstdio> int main() { int n,score; int hash[100]={0}; scanf("%d\n",&n); for(int i=0;i<
輸入N名學生某門功課的成績,統計各個分數段成績的人數
//輸入30名學生某門功課的成績,統計100分,90~99分,80~89分,70~79分,60~69分以及不及格的人數。 #include<stdio.h> int main() {
已確定學生人數,輸入成績求平均成績(JAVA)
1、已確定學生人數,輸入學生成績,求平均成績程式碼為:import java.util.Scanner; public class clock { private static Scanner sc; public static void main(String[]
統計多個學生的多門課的成績(結構體)
問題描述: 設有10個學生,每個學生的資料的包括學號,姓名,三門課的成績。要求從鍵盤輸入10個學生的資料,統計並列印 出三門課的平均成績,以及最高分的學生的資料(包括學號,姓名,三門課的成績,平均成績)。 演算法分析: 求每個學生的平均成績是要執行1.0次,所以使用for
16. 編寫函式,統計一批成績中各分數段的人數。
編寫函式,統計一批成績中各分數段的人數。 #include <stdio.h> void myfunc(int p[],int nsize,int tt[]) { for(in
讀入N名學生的成績,將獲得某一給定分數的學生人數輸出
#include<stdio.h> int main() { inta[1000],n,val,flag,i; while(scanf("%d",&n)&&n) { f
[ACM] hdu 1251 統計難題 (字典樹)
第一次 stdio.h scrip null 明顯 output 代碼 ane 處理 統計難題 Problem Description Ignatius近期遇到一個難題,老師交給他非常多單詞(僅僅有小寫字母組成,不會有反復的單詞出現),如今老師要他統計出以某
數據結構與算法題目集(中文)——5-13 統計工齡 (20分)——桶排序
color 單位 html out cin hit lis -s cnblogs 給定公司NN名員工的工齡,要求按工齡增序輸出每個工齡段有多少員工。 輸入格式: 輸入首先給出正整數NN(\le 10^5≤10?5??),即員工總人數;隨後給出NN個整數,即每個員工的工齡