結果
| 問題 |
No.2323 Nafmo、A+Bをする
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-05-28 14:33:47 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 537 bytes |
| コンパイル時間 | 1,809 ms |
| コンパイル使用メモリ | 167,612 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-27 02:00:33 |
| 合計ジャッジ時間 | 2,260 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 WA * 11 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
long long a, b;
cin >> a >> b;
long long c = a+b;
string s = to_string(c);
reverse(s.begin(), s.end());
long long N = s.size();
for(long long i=0; i<N; i++){
if(s[i] == '2') {
c -= pow(10, i);
c -= pow(10, i);
}
}
long long binary = c;
long long decimal = 0;
long long base = 1;
while(binary>0){
decimal = decimal + ( binary % 10 ) * base;
binary = binary / 10;
base = base * 2;
}
cout << decimal << endl;
}