|
|
вернуться в форумAC Послано DiG 28 апр 2012 19:16 Enjoy: var n:1..1000; i,e,l,m:1..1000; s:string[1]; begin readln(n); for i:=1 to n do begin readln(s); if s[1]='E' then inc(e); if s[1]='L' then inc(l); if s[1]='M' then inc(m); end; if (e>=l) and (e>=m) then writeln('Emperor Penguin'); if (l>=e) and (l>=m) then writeln('Little Penguin'); if (m>=e) and (m>=l) then writeln('Macaroni Penguin'); end. Good luck! Re: AC Послано ELDVN 1 ноя 2015 17:22 My Solution: #include <iostream> #include <string> #include <vector> #include <set> #include <queue> #include <map> #include <stack> #include <algorithm> #include <bitset> #include <cstring> #include <cmath> #include <cstdlib> #include <cstdio> #include <iomanip> #define F first #define S second #define ll long long #define len length() #define sqr(x) x*x #define pb push_back #define mp make_pair #define sz(x) ((int) (x).size()) #define all(x) x.begin(), x.end() #define allr(x) x.rbegin(), x.rend() #define bp(x) __builtin_popcount(x) #define INF numeric_limits<long long int>::max() #define frp freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it++) const int maxn = (int)1e6; const int mod = (int)1e9 + 7; using namespace std;
int n; string s,ss; int mx=-1; int e,l,m; main(){ scanf("%d",&n); while(n--){ cin>>s>>ss; for(int i=0; i < s.len; i++){ switch(s[i]){ case 'E':e++;break; case 'L':l++;break; case 'M':m++;break; } } } mx=max(mx,max(e,max(l,m))); if(mx==e) puts("Emperor Penguin"); else if(mx==l) puts("Little Penguin"); else if(mx==m) puts("Macaroni Penguin");
return 0; } |
|
|