結果
| 問題 |
No.8062 A + B
|
| コンテスト | |
| ユーザー |
mencotton
|
| 提出日時 | 2020-04-01 21:53:11 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 573 bytes |
| コンパイル時間 | 564 ms |
| コンパイル使用メモリ | 71,888 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-27 10:38:44 |
| 合計ジャッジ時間 | 1,034 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | WA * 8 |
ソースコード
#include <iostream>
#include <vector>
using namespace std;
vector<string> bin{"0", "1", "10", "11", "100"};
int main() {
string s, t;
cin >> s >> t;
bool x = true, y = true;
if (s[0] == '-')x = false, s = s.substr(1, s.size() - 1);
if (t[0] == '-')x = false, t = t.substr(1, t.size() - 1);
int a = -1, b = -1;
for (int i = 0; i < bin.size(); i++) {
if (s == bin[i])a = i;
if (t == bin[i])b = i;
}
int ret = (x ? a : -a) + (y ? b : -b);
if (ret < 0)cout << "-";
cout << bin[abs(ret)] << endl;
return 0;
}
mencotton