結果
| 問題 | No.3658 Darumaka Number 2 |
| コンテスト | |
| ユーザー |
nekoti
|
| 提出日時 | 2026-08-30 15:36:41 |
| 言語 | C (gcc 15.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 727 bytes |
| 記録 | |
| コンパイル時間 | 923 ms |
| コンパイル使用メモリ | 37,504 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2026-08-30 15:36:50 |
| 合計ジャッジ時間 | 3,456 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_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]--;
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