結果

問題 No.2224 UFO Game
ユーザー chro_96
提出日時 2023-02-24 21:26:09
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 398 bytes
コンパイル時間 221 ms
コンパイル使用メモリ 28,928 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-13 05:02:11
合計ジャッジ時間 810 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int main () {
  char s[12] = "";
  
  int res = 0;
  
  int idx = 0;
  long long ans = 0LL;
  int is_x = 0;
  
  res = scanf("%s", s);
  
  if (s[0] == 'x') {
    is_x = 1;
    idx++;
  }
  
  while (s[idx] != '\0') {
    ans *= 10LL;
    ans += (long long)(s[idx]-'0');
    idx++;
  }
  
  if (is_x > 0) {
    ans = (1LL<<32)-ans;
  }
  
  printf("%lld\n", ans);
  return 0;
}
0