結果
| 問題 | No.345 最小チワワ問題 |
| コンテスト | |
| ユーザー |
funakoshi
|
| 提出日時 | 2019-08-20 10:42:07 |
| 言語 | C (gcc 15.2.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,033 bytes |
| 記録 | |
| コンパイル時間 | 183 ms |
| コンパイル使用メモリ | 29,568 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-06 11:44:46 |
| 合計ジャッジ時間 | 1,220 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | AC * 6 WA * 23 |
ソースコード
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
int main(void)
{
char str[120]="";
int c=0,w=0,len=0,minlen=999;
bool cin=false;
bool win=false;
scanf("%s",str);
for(int i=0;i<strlen(str)-1;i++)
{
if(str[i]=='c')
{
cin=true;
len++;
}
else
{
continue;
}
if(cin==true)
{
for(int j=i+1;j<strlen(str);j++)
{
if(str[j]=='w'&&win==false)
{
win=true;
}
else if(win=true)
{
len++;
if(minlen>len)
{
minlen=len;
}
len=0;
break;
}
len++;
}
}
}
if(minlen!=999)
{
printf("%d",len);
}
else
{
printf("-1");
}
}
funakoshi