めがね / paizaOnlineHackathon7
#include <iostream> using namespace std; int q[100][100], p[10][10]; bool Check(int m, int y, int x) { bool flg = true; for (int i=0; i<m; ++i) for (int j=0; j<m; ++j) { if (i==0 && j==0) continue; if (q[y+i][x+j] != p[i][j]) { flg = false; break; } } return flg; } void Solve(int n) { int m; for (int i=0; i<n; ++i) for (int j=0; j<n; ++j) cin >> q[i][j]; cin >> m; for (int i=0; i<m; ++i) for (int j=0; j<m; ++j) cin >> p[i][j]; for (int i=0; i<=n-m; ++i) for (int j=0; j<=n-m; ++j) if (q[i][j] == p[0][0]) if ( Check(m,i,j) ) cout << i << " " << j << endl; } int main(void) { int n; cin >> n; Solve(n); return 0; }
パターンの左上が一致していた場合、全て合致しているか一から調べていく。
合致している場合は、その座標を出力。
〜了〜
メイド服セット / paizaOnlineHackathon7
#include <iomanip> #include <iostream> using namespace std; void Solve(int n) { int m, answer; for (int i=0; i<n; ++i) { cin >> m; answer = 24*60+60-m/3; cout << setw(2) << setfill('0') << (answer/60)%24 << ":"; cout << setw(2) << setfill('0') << answer%60 << endl; } } int main(void) { int n; cin >> n; Solve(n); return 0; }
時間を全て分に直しておく。6時間眠り7時に起きることから残業時間がない場合は1時に就寝する。
なので初期時間は24時間+1時間とし、そこから残業した時間の1/3だけ引く。
最後に時間を出力形式に則り出力。
〜了〜
縞ニーソセット / paizaOnlineHackathon7
#include <iostream> #include <string> using namespace std; void Solve(int n) { int m; string answer = ""; bool flg = true; cin >> m; for (int i=1; i<=m; ++i) { answer += (flg? 'R' : 'W'); if ( !(i%n) ) flg = (flg? false : true); } cout << answer << endl; } int main(void) { int n; cin >> n; Solve(n); return 0; }
割り切れた場合はRとWを入れ替え、結果を出力。
〜了〜
カーディガンセット / paizaOnlineHackathon7
#include <iostream> using namespace std; void Solve(int n) { int answer = 1; for (int i=2; i<=n; ++i) answer *= i; cout << answer << endl; } int main(void) { int n; cin >> n; Solve(n); return 0; }
階乗を出力。
〜了〜
セーラー服セット / paizaOnlineHackathon7
#include <iostream> #include <string> using namespace std; void Solve(int n) { string answer = "", str; cin.ignore(); for (int i=0; i<n; ++i) { getline(cin,str); if (i != 0) answer += "_"; answer += str; } cout << answer << endl; } int main(void) { int n; cin >> n; Solve(n); return 0; }
最初以外 _ を追加する。最終的に結果を出力。
〜了〜
ツインテールセット / paizaOnlineHackathon7
#include <iostream> using namespace std; void Solve(void) { int c1, p1, c2, p2; double drink1, drink2; cin >> c1 >> p1 >> c2 >> p2; drink1 = c1/(double)p1; drink2 = c2/(double)p2; cout << (drink1 > drink2? "1" : "2") << endl; } int main(void) { Solve(); return 0; }
比較して大きい方の数字を出力。
〜了〜
ポニーテールセット / paizaOnlineHackathon7
#include <iostream> using namespace std; void Solve(int n) { for (int i=n; i>=0; --i) { if (i == 0) cout << "0!!" << endl; else cout << i << endl; } } int main(void) { int n; cin >> n; Solve(n); return 0; }
0の場合は、0!!と出力。
〜了〜