Sicily 1486. 统计数字

来源:互联网 发布:淘宝微信号怎么买 编辑:程序博客网 时间:2024/06/06 01:51

超恶心, 经常TL

一定不能用c++的cin cout, 要改用c的printf 和 scanf

还用了stl的map.

// Problem#: 1486// Author#: Reid Chan#include <iostream>#include <cstdio>#include <map>using namespace std;int main() {    int n;    bool f = true;    while (cin >> n) {        if (f) { f = false; }        else { printf("\n"); }        map<int, int> rst;        map<int, int>::iterator it;        int key;        for (int i = 0; i < n; ++i) {            scanf("%d", &key);            rst[key]++;        }        for (it = rst.begin(); it != rst.end(); it++) {            printf("%d %d\n", it->first, it->second);        }    }    return 0;}                                                                 


0 0
原创粉丝点击