結果
問題 |
No.1806 Rotating Golem
|
ユーザー |
|
提出日時 | 2022-02-19 09:30:41 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 382 bytes |
コンパイル時間 | 1,496 ms |
コンパイル使用メモリ | 167,864 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-29 10:14:42 |
合計ジャッジ時間 | 2,163 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(void) { char a, b; cin >> a >> b; string str_dir = "NESW"; int n_a = 0, n_b = 0; for (int i = 0; i < str_dir.size(); i++) { if (a == str_dir[i]) n_a = i; if (b == str_dir[i]) n_b = i; } if (n_a <= n_b) cout << abs(n_a - n_b) << endl; else cout << str_dir.size() - abs(n_a - n_b) << endl; return 0; }