結果
問題 |
No.1806 Rotating Golem
|
ユーザー |
![]() |
提出日時 | 2022-01-14 21:23:56 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 550 bytes |
コンパイル時間 | 1,710 ms |
コンパイル使用メモリ | 166,676 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-20 07:39:55 |
合計ジャッジ時間 | 2,428 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:21:15: warning: 'q' may be used uninitialized [-Wmaybe-uninitialized] 21 | cout << (q+4-p)%4 << endl; | ~^~ main.cpp:14:11: note: 'q' was declared here 14 | int p,q; | ^ main.cpp:21:17: warning: 'p' may be used uninitialized [-Wmaybe-uninitialized] 21 | cout << (q+4-p)%4 << endl; | ~~~~^~~ main.cpp:14:9: note: 'p' was declared here 14 | int p,q; | ^
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll,ll>; #define rep(i, n) for(int i = 0; i < n; i++) #define all(x) (x).begin(),(x).end() template<class T>bool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;} template<class T>bool chmax(T&a, const T&b){if(a<b){a=b;return 1;}return 0;} int main(){ string s = "NESW"; char a,b; cin >> a >> b; int p,q; rep(i,4){ if(a==s[i]) p = i; } rep(i,4){ if(b==s[i]) q = i; } cout << (q+4-p)%4 << endl; return 0; }