結果

問題 No.2224 UFO Game
ユーザー ineedyourlovep
提出日時 2023-02-24 21:29:08
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 20 ms / 2,000 ms
コード長 681 bytes
コンパイル時間 1,808 ms
コンパイル使用メモリ 193,340 KB
最終ジャッジ日時 2025-02-10 20:31:01
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
//const int mod = 1000000007;
const ll mod = LINF;

// POWER_MODver. N^k % MOD
ll mod_pow(ll n, ll k){
  ll res = 1;
  for(; k > 0; k >>= 1){
    if(k&1) res = (res*n)%mod;
    n = (n*n)%mod;
  }
  return res;
}


int main()
{
  string s, t;
  cin >> s;
  bool flag = true;
  if (s[0] == 'x') t = s.substr(1);
  else {
    t = s.substr(0);
    flag = false;
  }
  ll n = stoll(t);
  if (!flag) cout << n << endl;
  else cout << mod_pow(2, 32) - n << endl;
  return 0;
}
0