Pat乙级 1038 统计同成绩学生
生活随笔
收集整理的這篇文章主要介紹了
Pat乙级 1038 统计同成绩学生
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Pat乙級1038統計同成績學生
- 思路
- 代碼
題目網址
https://pintia.cn/problem-sets/994805260223102976/problems/994805284092887040
思路
注意下cin會超時。
代碼
#include<iostream> #define MAX 100005using namespace std;int result[101] = {0};int main() {int n;int k;int index;int cnt = 0;int d;// cin >> n;scanf("%d", &n);for (int i = 0; i < n; i ++) { // cin >> d;scanf("%d", &d);result[d] ++;}cin >> k;for (int i = 0; i < k; i ++) { // cin >> d;scanf("%d", &d);if (i <= 0) // cout << result[d];printf("%d", result[d]);else // cout << " " << result[d];printf(" %d", result[d]);}return 0; }總結
以上是生活随笔為你收集整理的Pat乙级 1038 统计同成绩学生的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Pat乙级 1058 选择题
- 下一篇: Pat乙级 1040 有几个PAT