結果

問題 No.1806 Rotating Golem
ユーザー tnakao0123tnakao0123
提出日時 2022-01-15 19:12:26
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 495 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 40,132 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-21 22:20:27
合計ジャッジ時間 1,112 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 1806.cc:  No.1806 Rotating Golem - yukicoder
 */

#include<cstdio>
#include<algorithm>
 
using namespace std;

/* constant */

const int M = 4;
const char dcs[] = "NESW";

/* typedef */

/* global variables */

int cmap[128];

/* subroutines */

/* main */

int main() {
  for (int i = 0; dcs[i]; i++) cmap[dcs[i]] = i;

  char s[4], t[4];
  scanf("%s%s", s, t);

  int a = cmap[s[0]], b = cmap[t[0]];
  int n = (b + M - a) % M;
  printf("%d\n", n);
  return 0;
}
0