Submission #19203
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | #include<stdio.h> int main(){ int h,w,i,j,cnt=0; scanf ( "%d %d" ,&h,&w); int a[h+1][w+1]; char s[h+1][w+1]; for (i=1;i<=h;i++){ scanf ( "%s" ,s[i]); } for (i=1;i<=h;i++){ for (j=0;j<w;j++){ if (s[i][j]== 'c' ){ a[i][j]=0; } else { cnt=j; while (1){ if (cnt==-1){ a[i][j]=-1; break ; } if (s[i][cnt]== 'c' ){ a[i][j]=j-cnt; break ; } cnt--; } cnt=0; } } } for (i=1;i<=h;i++){ for (j=0;j<w;j++){ if (j+1==w){ printf ( "%d\n" ,a[i][j]); } else { printf ( "%d " ,a[i][j]); } } } return (0); } |
ステータス
項目 | データ |
---|---|
問題 | 0205 - 気象予報士 (Weather Forecaster) |
ユーザー名 | r1705 |
投稿日時 | 2017-06-09 17:41:28 |
言語 | C |
状態 | Accepted |
得点 | 5 |
ソースコード長 | 637 Byte |
最大実行時間 | 36 ms |
最大メモリ使用量 | 696 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | IN1 | 1 / 1 | *2015-yo-t3-in1.txt |
2 | IN2 | 1 / 1 | *2015-yo-t3-in2.txt |
3 | IN3 | 1 / 1 | *2015-yo-t3-in3.txt |
4 | IN4 | 1 / 1 | *2015-yo-t3-in4.txt |
5 | IN5 | 1 / 1 | *2015-yo-t3-in5.txt |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # | ||||
---|---|---|---|---|---|---|---|---|
2015-yo-t3-in1.txt | AC | 29 ms | 480 KB |
1
|
||||
2015-yo-t3-in2.txt | AC | 9 ms | 536 KB |
2
|
||||
2015-yo-t3-in3.txt | AC | 36 ms | 696 KB |
3
|
||||
2015-yo-t3-in4.txt | AC | 10 ms | 608 KB |
4
|
||||
2015-yo-t3-in5.txt | AC | 12 ms | 588 KB |
5
|