結果
問題 | No.351 市松スライドパズル |
ユーザー |
![]() |
提出日時 | 2016-03-11 22:34:40 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 143 ms / 2,000 ms |
コード長 | 1,146 bytes |
コンパイル時間 | 819 ms |
コンパイル使用メモリ | 94,784 KB |
実行使用メモリ | 13,336 KB |
最終ジャッジ日時 | 2024-09-25 02:27:22 |
合計ジャッジ時間 | 3,543 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 17 |
コンパイルメッセージ
main.cpp: In constructor ‘st::st()’: main.cpp:47:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 47 | scanf("%s%d", buf, &k); | ~~~~~^~~~~~~~~~~~~~~~~
ソースコード
#include<iostream> #include<cstdio> #include<cstring> #include<string> #include<cctype> #include<cstdlib> #include<algorithm> #include<bitset> #include<cstdio> #include<cstring> #include<string> #include<cctype> #include<cstdlib> #include<algorithm> #include<bitset> #include<vector> #include<list> #include<deque> #include<queue> #include<map> #include<set> #include<stack> #include<cmath> #include<sstream> #include<fstream> #include<iomanip> #include<ctime> #include<complex> #include<functional> #include<climits> #include<cassert> #include<iterator> using namespace std; int h; int w; char buf[3]; struct st{ char s; int k; st(){ scanf("%s%d", buf, &k); s = buf[0]; } }; vector<st> v; int main(){ cin >> h >> w; int n; cin >> n; for (int i = 0; i < n; i++){ v.push_back(st()); } reverse(v.begin(), v.end()); int x = 0; int y = 0; for (int i = 0; i < v.size(); i++){ if (v[i].s == 'R'&&v[i].k==x){ y += w - 1; y %= w; } else{ if (v[i].s == 'C'&&v[i].k == y){ x += h - 1; x %= h; } } } int k = (x + y); k %= 2; if (k == 0){ puts("white"); } else{ puts("black"); } return 0; }