結果
| 問題 | No.3308 One-time Changed Formula |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-10-24 21:31:13 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 2,000 ms |
| + 78µs | |
| コード長 | 764 bytes |
| 記録 | |
| コンパイル時間 | 1,080 ms |
| コンパイル使用メモリ | 210,044 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-07-15 22:56:38 |
| 合計ジャッジ時間 | 2,565 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 15 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int T; cin >> T;
while(T--){
int N; cin >> N;
string s; cin >> s;
int answer = 0;
bool plus = true;
for(auto c : s){
if(c == '+'){
if(plus) answer += 9;
plus = true;
}
else if(c == '-'){
if(plus) answer += 9;
plus = false;
}
else if(c == '*'){
if(plus) answer += 9;
}
else{
if(plus) answer += 9-(c-'0');
else answer += c-'0'-1;
}
}
cout << answer << "\n";
}
}