結果
| 問題 |
No.2224 UFO Game
|
| コンテスト | |
| ユーザー |
hiro71687k
|
| 提出日時 | 2023-02-24 21:22:32 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 693 bytes |
| コンパイル時間 | 3,524 ms |
| コンパイル使用メモリ | 250,168 KB |
| 最終ジャッジ日時 | 2025-02-10 20:21:27 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using namespace std;
using ll=long long;
using ld=double;
ld pie=3.14159265359;
ll mod=998244353;
ll inf=100000;
ll modpow(ll x, ll n) {
if(n==0) return 1; //再帰の終了条件
else if(n%2==1) {
return (x*modpow(x, n-1)); //nが奇数ならnを1ずらす
}
else return modpow((x*x), n/2); //nが偶数ならnが半分になる
}
int main(){
string s;
cin >> s;
if (s[0]!='x')
{
cout << s << endl;
}else{
reverse(s.begin(),s.end());
s.pop_back();
reverse(s.begin(),s.end());
ll x=stoll(s);
cout << modpow(2,32)-x << endl;
}
}
hiro71687k