結果
| 問題 | No.222 引き算と足し算 |
| コンテスト | |
| ユーザー |
CELICA
|
| 提出日時 | 2020-10-23 06:32:22 |
| 言語 | C++14 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 1 ms / 1,000 ms |
| + 411µs | |
| コード長 | 542 bytes |
| 記録 | |
| コンパイル時間 | 4,331 ms |
| コンパイル使用メモリ | 300,828 KB |
| 実行使用メモリ | 9,396 KB |
| 最終ジャッジ日時 | 2026-08-21 13:22:59 |
| 合計ジャッジ時間 | 5,854 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 31 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ul = unsigned long;
using ull = unsigned long long;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
string s;
cin >> s;
string pattern = "([+-]*\\d+)([+-]+)(\\d+)";
regex re(pattern);
smatch match;
regex_match(s, match, re);
int res1=stoi(match.str(1)),res2=stoi(match.str(3));
if (match.str(2) == "+" || match.str(2) == "--" || match.str(2) == "++")
res2 *= -1;
cout << res1 + res2 << "\n";
return 0;
}
CELICA