2010-08-16から1日間の記事一覧

AOJ 0046 Differential

404 Not Found #include <vector> #include <cstdio> #include <algorithm> using namespace std; int main() { double n; vector<double> v; while(~scanf("%lf", &n)) v.push_back(n); sort(v.begin(), v.end()); printf("%.1lf\n", *v.rbegin() - *v.begin()); return 0; }</double></algorithm></cstdio></vector>

AOJ 0077 Run Length

404 Not Found #include <cstdio> #include <cstring> int main() { char s[101]; while(fgets(s, 101, stdin)){ for(int i = 0, l = strlen(s); i < l; i++){ if(s[i] == '@'){ for(int j = 0; j < s[i + 1] - '0'; j++) putchar(s[i + 2]); i += 2; }else{ putchar(s[i]); }</cstring></cstdio>…

AOJ 0051 Differential II

404 Not Found #include <cstdio> #include <vector> #include <cstdlib> #include <algorithm> using namespace std; int main() { int n; char s[9]; scanf("%d\n", &n); for(int i = 0; i < n; i++){ int max, min; vector<int> v; scanf("%8s", s); for(int j = 0; j < 8; j++) v.push_back(s[j] -</int></algorithm></cstdlib></vector></cstdio>…

AOJ 0028 Mode Value

404 Not Found #include <cstdio> #include <map> #include <vector> #include <algorithm> using namespace std; int main() { map <int, int> m; map <int, vector<int> > l; int n; while(~scanf("%d\n", &n)) m[n]++; for(map<int, int>::iterator it = m.begin(); it != m.end(); it++) l[(*it).second].push_back((*i…</int,></int,></int,></algorithm></vector></map></cstdio>

AOJ 0052 Factorial II

404 Not Found #include <cstdio> int main() { int n, a; while(a = 0, scanf("%d\n", &n), n){ while(n /= 5) a += n; printf("%d\n", a); } return 0; } すいません、解き方ぐぐりました。 階乗の末尾の 0 の個数数学的知識は乏しいのでそれぞれ覚えていくしかな</cstdio>…

AOJ 0049 Blood Group

404 Not Found #include <cstdio> #include <string> #include <map> using namespace std; int main() { char s[3]; map<string, int> m; while(~scanf("%*d,%2s", s)) m[string(s)]++; printf("%d\n%d\n%d\n%d\n", m["A"], m["B"], m["AB"], m["O"]); return 0; }</string,></map></string></cstdio>

AOJ 0031 Weight

404 Not Found #include <cstdio> #include <vector> using namespace std; int main() { int n; while(~scanf("%d\n", &n)){ vector<int> v; for(int i = 512; 1 <= i; i /= 2){ if(n < i) continue; n -= i; v.push_back(i); if(n <= 0) break; } for(int i = v.size() - 1; 0 <</int></vector></cstdio>…