提出 #6505329


ソースコード 拡げる

#include<stdio.h>

int main(void){
  char str[200002];
  int count=0,han=0,n=0,j=0;;
   scanf("%d",&n);

  scanf("%s",str);
  while(count<n){
    if(str[count]=='#'){
       if(str[count+1]=='#'){
           if(str[count+2]=='.'){
              str[count+2]='#'; 
              han++;
              j=1;
           }
        }           
       if(count==n-1){
         if(str[n-1]=='#')
            break;
       }
      if(j==0&&str[count+1]!='#'){
        str[count]='.';
        han++;
      }
    }else if(str[count]=='.'){
             if(str[count+1]=='#'){
                if(str[count+2]=='.'){
                   str[count+1]='.'; 
                   han++;
                   j=1;
           }
        }           
    }
   j=0;
   count++;
  }
  printf("%d\n",han);
  return 0;
}

提出情報

提出日時
問題 C - Stones
ユーザ s1870264
言語 C (GCC 5.4.1)
得点 0
コード長 830 Byte
結果 WA
実行時間 2 ms
メモリ 384 KiB

コンパイルエラー

./Main.c: In function ‘main’:
./Main.c:6:4: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d",&n);
    ^
./Main.c:8:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%s",str);
   ^

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 0 / 300
結果
AC × 3
AC × 19
WA × 6
セット名 テストケース
Sample s1.txt, s2.txt, s3.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, s1.txt, s2.txt, s3.txt
ケース名 結果 実行時間 メモリ
01.txt WA 2 ms 384 KiB
02.txt WA 2 ms 384 KiB
03.txt AC 2 ms 384 KiB
04.txt WA 2 ms 384 KiB
05.txt WA 2 ms 384 KiB
06.txt WA 2 ms 384 KiB
07.txt AC 1 ms 384 KiB
08.txt AC 1 ms 384 KiB
09.txt AC 1 ms 384 KiB
10.txt AC 1 ms 384 KiB
11.txt WA 1 ms 384 KiB
12.txt AC 1 ms 384 KiB
13.txt AC 1 ms 384 KiB
14.txt AC 1 ms 384 KiB
15.txt AC 1 ms 384 KiB
16.txt AC 1 ms 384 KiB
17.txt AC 1 ms 384 KiB
18.txt AC 1 ms 384 KiB
19.txt AC 0 ms 128 KiB
20.txt AC 1 ms 128 KiB
21.txt AC 1 ms 128 KiB
22.txt AC 1 ms 128 KiB
s1.txt AC 1 ms 128 KiB
s2.txt AC 1 ms 128 KiB
s3.txt AC 1 ms 128 KiB