2015-11-01から1ヶ月間の記事一覧

A - A / AtCoderBeginnerContest#013

abc013.contest.atcoder.jp #include <iostream> using namespace std; void Solve(char x) { cout << x-'A'+1 << endl; } int main(void) { char x; cin >> x; Solve(x); return 0; } Aから1+何番目かを出力。 ~了~</iostream>

C - 九九足し算 / AtCoderBeginnerContest#012

abc012.contest.atcoder.jp #include <iostream> using namespace std; void Solve(int n) { for (int i=1; i<=9; ++i) for (int j=1; j<=9; ++j) if (45*45-n == i*j) cout << i << " x " << j << endl; } int main(void) { int n; cin >> n; Solve(n); return 0; } </iostream>…

B - 入浴時間 / AtCoderBeginnerContest#012

abc012.contest.atcoder.jp #include <iomanip> #include <iostream> using namespace std; void Solve(int n) { int h=n/3600, m=(n%3600)/60, s=n%60; cout << setw(2) << setfill('0') << h << ":"; cout << setw(2) << setfill('0') << m << ":"; cout << setw(2) << setfil</iostream></iomanip>…

A - スワップ / AtCoderBeginnerContest#012

abc012.contest.atcoder.jp #include <algorithm> #include <iostream> using namespace std; void Solve(int a, int b) { swap(a,b); cout << a << " " << b << endl; } int main(void) { int a, b; cin >> a >> b; Solve(a,b); return 0; } swapでaの値とbの値を入れ替え出力。 </iostream></algorithm>…

C - 123引き算 / AtCoderBeginnerContest#011

abc011.contest.atcoder.jp #include <algorithm> #include <iostream> using namespace std; #define INF (1<<29) void Solve(int n) { int ng1, ng2, ng3; int dp[300+1]; bool flg=true; cin >> ng1 >> ng2 >> ng3; if (n==ng1 || n==ng2 || n==ng3) flg=false; if (flg) { for</iostream></algorithm>…

B - 名前の確認 / AtCoderBeginnerContest#011

abc011.contest.atcoder.jp #include <cctype> #include <iostream> #include <string> using namespace std; void Solve(string s) { s[0]=toupper(s[0]); for (int i=1; i<s.length(); ++i) s[i]=tolower(s[i]); cout << s << endl; } int main(void) { string s; cin >> s; Solve(s); return 0; } 最初の文字を大文字、以降の文字を小文字変換…</s.length();></string></iostream></cctype>

A - 来月は何月? / AtCoderBeginnerContest#010

abc011.contest.atcoder.jp #include <iostream> using namespace std; void Solve(int n) { (n==12)? n=1 : ++n; cout << n << endl; } int main(void) { int n; cin >> n; Solve(n); return 0; } 12月なら1月にして、他の場合は1を足す。 ~了~</iostream>

C - 浮気調査 / AtCoderBeginnerContet#010

abc010.contest.atcoder.jp #include <cmath> #include <iostream> using namespace std; void Solve(int txa, int tya, int txb, int tyb, int T, int V) { int n, x, y; bool flg=false; cin >> n; for (int i=0; i<n; ++i) { cin >> x >> y; if (sqrt( pow( (double)x-txa,2.0 )+pow( (doub</n;></iostream></cmath>…