結果
| 問題 | No.3658 Darumaka Number 2 |
| コンテスト | |
| ユーザー |
nekoti
|
| 提出日時 | 2026-08-30 15:39:11 |
| 言語 | C (gcc 15.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 857 bytes |
| 記録 | |
| コンパイル時間 | 970 ms |
| コンパイル使用メモリ | 37,376 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2026-08-30 15:39:17 |
| 合計ジャッジ時間 | 2,588 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 WA * 15 |
ソースコード
#define _DEBUG 0
#include<stdio.h>
#include<stdbool.h>
#include<string.h>
#include<stdlib.h>
int main(void)
{
int scan;//scanf警告用
int ans=0;
int i, j;
char s[100010];scan=scanf("%s",s);int slen=strlen(s);
int notindex = -1;
bool topNG = false;
for(i=0; i<slen; i++)
{
if(s[i]-'0' < 4)
{
notindex = i;
if(i)
{
s[i-1]--;
if(s[i-1]-'0' < 4)
{
notindex = i-1;
if(0==i-1)topNG=true;
}
}
else if(0==i)topNG=true;
break;
}
}
//■出力
bool output5 = false;
for(i=0; i<slen; i++)
{
if(!output5)
{
if(notindex == i) output5 = true;
else if(s[i]-'0' == 4)printf("4");
else printf("5");
}
if(topNG){topNG=false;continue;}
if(output5)printf("5");
}
return scan-scan;
}
nekoti