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

AOJ 0045 Sum and Average

404 Not Found #include <cstdio> int main() { int m, n; int total = 0, ave = 0, row = 0; while(~scanf("%d,%d\n", &m, &n)){ total += m * n; ave += n; row++; } printf("%d\n%d\n", total, (int)(ave / (double)row + 0.5)); return 0; } こういう簡単な問題</cstdio>…

AOJ 0050 Apple and Peach

404 Not Found #include <iostream> #include <vector> #include <string> using namespace std; int main() { string s; vector<int> pe, ap; int n; getline(cin, s); pe.push_back(0); ap.push_back(0); while(n=s.find("peach", pe.back() + 5), ~n) pe.push_back(n); while(n=s.find("a</int></string></vector></iostream>…

AOJ 0064 Secret Number

404 Not Found #include <cstdio> int main(){ int n = 0, sum = 0; char c; while(c = getchar(), ~c){ if('0' <= c && c <= '9'){ n *= 10;n += c - '0'; }else{ sum += n;n = 0; } } printf("%d\n", sum); return 0; }</cstdio>