Ural1585(细节)
2015-03-05 13:59
218 查看
题目链接:点击打开链接
解题思路:
很简单,但细节很坑。用getline之前要来个getchar把输入n后的回车吃掉,经过被加速器坑过这么多次后,我就决定以后还是不用加速器了。
完整代码:
更多精彩请访问:点击打开链接
解题思路:
很简单,但细节很坑。用getline之前要来个getchar把输入n后的回车吃掉,经过被加速器坑过这么多次后,我就决定以后还是不用加速器了。
完整代码:
#include <algorithm> #include <iostream> #include <cstring> #include <climits> #include <cstdio> #include <string> #include <cmath> #include <map> #include <queue> using namespace std; typedef long long LL; const int MOD = int(1e9)+7; const int INF = 0x3f3f3f3f; const double EPS = 1e-9; const double PI = acos(-1.0); //M_PI; string s; int max(int a , int b , int c) { int k = a > b ? a : b; return k > c ? k : c; } int main() { #ifdef DoubleQ freopen("in.txt","r",stdin); #endif int n; cin >> n; int a = 0 , b = 0 , c = 0; getchar(); for(int i = 0 ; i < n ; i ++) { getline(cin , s); if(s == "Emperor Penguin") a ++; else if(s == "Little Penguin") b ++; else if(s == "Macaroni Penguin") c ++; } int res = max(a , b , c); if(res == a) cout << "Emperor Penguin" << endl; else if(res == b) cout << "Little Penguin" << endl; else if(res == c) cout << "Macaroni Penguin" << endl; }
更多精彩请访问:点击打开链接
相关文章推荐
- URAL 1036 Lucky Tickets
- alsa编程细节
- 2-Java数据类型及转换细节、运算符
- C语言知识点及细节
- (转)从底层的角度看一下malloc和free的细节
- Java提高篇(三六)-----java集合细节(二):asList的缺陷
- python 多线程 join 的 细节问题 注意使用事项
- 编程之路小细节-进位保留小数位
- 连接Access 你未曾遇到过的细节错误
- JavaScript中的一些细节
- 82_Fragment相关细节
- anduraljs的表格删除和查找关键字
- 细节应用办公更舒展
- 交互体验细节战——用户登录
- 易错小细节
- 1星|《我怎么没想到》:古龙武侠小说风格,有故事没细节,没有实际的商业价值
- ALSA编程细节分析
- vertical-align:middle的居中细节调整
- TCP/IP详解学习笔记(5)-IP选路,动态选路,和一些细节
- URAL1099-Work Scheduling(一般图最大匹配(带花树))