結果
| 問題 |
No.3021 Maximize eval
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-02-14 21:36:19 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 584 bytes |
| コンパイル時間 | 1,466 ms |
| コンパイル使用メモリ | 161,376 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2025-02-14 21:36:48 |
| 合計ジャッジ時間 | 2,605 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 2 WA * 13 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
10 | scanf("%d",&T);
| ~~~~~^~~~~~~~~
main.cpp:13:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
13 | scanf("%s",s+1);
| ~~~~~^~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF=0x3f3f3f3f;
const int MAX=5e5+10;
char s[MAX];
int main()
{
int T,n,i,op;
scanf("%d",&T);
while(T--)
{
scanf("%s",s+1);
n=strlen(s+1);
op=1;
for(i=1;i<=n;i++)
{
if(s[i]=='-') op=-1;
else if(s[i]=='+') op=1;
else if(s[i]=='?')
{
if(op==0)
{
if(i<n) s[i]='+';
else s[i]='1';
op=1;
}
else if(op==-1)
{
s[i]='1';
op=0;
}
else s[i]='9';
}
else
{
if(op==-1) op=0;
}
}
s[n+1]='\0';
puts(s+1);
}
return 0;
}