結果

問題 No.1806 Rotating Golem
ユーザー sistersatori_
提出日時 2022-01-15 00:44:44
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 448 bytes
コンパイル時間 664 ms
コンパイル使用メモリ 65,788 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-20 17:06:36
合計ジャッジ時間 1,181 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'std::string turn(std::string)':
main.cpp:13:1: warning: control reaches end of non-void function [-Wreturn-type]
   13 | }
      | ^

ソースコード

diff #

#include <iostream>
using namespace std;

string turn(string direction) {
    if (direction == "N")
        return "E";
    else if (direction == "E")
        return "S";
    else if (direction == "S")
        return "W";
    else if (direction == "W")
        return "N";
}

int main()
{
    string A, B;
    cin >> A >> B;

    int ans = 0;
    while (A != B) {
        A = turn(A);
        ans++;
    }

    cout << ans << endl;
    return 0;
}
0