結果

問題 No.1806 Rotating Golem
ユーザー YuffterYuffter
提出日時 2022-02-15 11:15:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 3,178 bytes
コンパイル時間 1,763 ms
コンパイル使用メモリ 182,136 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-11 16:59:16
合計ジャッジ時間 2,906 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,384 KB
testcase_15 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
class extension {
    //イテレーター省略
#define all(v) v.begin(),v.end()
//配列の読み取り
#define loadVector(n,v) for (int i = 0;i < n;i++) cin >> v[i]
//pair型配列の読み取り
#define loadVectors(n,v) for (int i = 0;i < n;i++) cin >> v[i].first >> v[i].second
//逆ソート
#define r_sort(v) sort(v.rbegin(),v.rend())
//long long省略
#define ll long long
//指定したkeyがmapに存在するかどうか
#define mapFind(m,x) m.find(x) != end(m)
//long doubleの省略
#define ld long double

//nをbase_number進数に変換する
public:string to_oct(int n, int base_number) {
    string s;
    while (n) {
        s = to_string(n % base_number) + s;
        n /= base_number;
    }
    return s;
}

      //エラトステネスの篩
public:vector<int> Eratosthenes(int N)
{
    std::vector<bool> is_prime(N + 1);
    for (int i = 0; i <= N; i++)
    {
        is_prime[i] = true;
    }
    std::vector<int> P;
    for (int i = 2; i <= N; i++)
    {
        if (is_prime[i])
        {
            for (int j = 2 * i; j <= N; j += i)
            {
                is_prime[j] = false;
            }
            P.emplace_back(i);
        }
    }
    return P;
}

      //文字列を分割する
      vector<string> split(string str, char del) {
          int first = 0;
          int last = str.find_first_of(del);

          vector<string> result;

          while (first < str.size()) {
              string subStr(str, first, last - first);

              result.push_back(subStr);

              first = last + 1;
              last = str.find_first_of(del, first);

              if (last == string::npos) {
                  last = str.size();
              }
          }

          return result;
      }

      vector<ll> divisor(ll n) {
          vector<ll> result;
          set<ll> s;
          for (ll i = 1; i <= sqrt(n); i++) {
              if (n % i == 0) {
                  s.insert(i);
                  s.insert(n / i);
              }
          }

          for (int x : s) {
              result.push_back(x);
          }
          return result;
      }
};
int main(void) {
    // Your code here!
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    //拡張クラスのインスタンス化
    extension ex = extension();

    string a,b;
    cin >> a >> b;
    
    map<string,int> m;
    m["N"] = 360;
    m["S"] = 180;
    m["W"] = 270;
    m["E"] = 90;
    
    if (a == b) {
        cout << 0 << endl;
        return 0;
    }
    
    if (a == "N") {
        if (b == "S") cout << 2 << endl;
        if (b == "W") cout << 3 << endl;
        if (b == "E") cout << 1 << endl;
    }
    if (a == "S") {
        if (b == "N") cout << 2 << endl;
        if (b == "W") cout << 1 << endl;
        if (b == "E") cout << 3 << endl;
    }
    if (a == "W") {
        if (b == "N") cout << 1 << endl;
        if (b == "S") cout << 3 << endl;
        if (b == "E") cout << 2 << endl;
    }
    if (a == "E") {
        if (b == "N") cout << 3 << endl;
        if (b == "W") cout << 2 << endl;
        if (b == "S") cout << 1 << endl;
    }
}
0