Submission #3382440
Source Code Expand
#include<bits/stdc++.h> using namespace std; const int N = 200; const int inf = 0x3f3f3f; char a[ N ]={0};int b[N]={0}; int main() { // freopen("1.txt","r",stdin); int n; scanf("%d",&n); for ( int i = 0 ; i <= n; i++) scanf("%c",&a[i]); for ( int i = 1; i <= n; i++) b[i] = inf; if ( a[1] == 'X') b[1] = 1; else b[1] = 0 ; for ( int i = 1; i <= n; i++) { if ( a[ i+1 ] == 'X'){ b[i+1] = min(b[i+1] , b[i]+1); } else { b[i+1] = min(b[i+1] , b[i]); } if ( a[ i+2 ] == 'X'){ b[i+2] = min(b[i+2] , b[i]+1); } else { b[i+2] = min(b[i+2] , b[i]); } if ( a[ i+3 ] == 'X'){ b[i+3] = min(b[i+3] , b[i]+1); } else { b[i+3] = min(b[i+3] , b[i]); } } printf("%d",b[n]); return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - 雨上がり |
User | luogu_bot4 |
Language | C++ (GCC 5.4.1) |
Score | 0 |
Code Size | 798 Byte |
Status | WA |
Exec Time | 1 ms |
Memory | 256 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:9:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] int n; scanf("%d",&n); ^ ./Main.cpp:11:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%c",&a[i]); ^
Judge Result
Set Name | All | ||
---|---|---|---|
Score / Max Score | 0 / 50 | ||
Status |
|
Set Name | Test Cases |
---|---|
All | case_000.txt, case_001.txt, case_002.txt, case_003.txt, case_004.txt, case_005.txt, case_006.txt, case_007.txt, case_008.txt, case_009.txt, case_010.txt, case_011.txt, case_012.txt, case_013.txt, case_014.txt, case_015.txt, case_016.txt, case_017.txt, case_018.txt, case_019.txt, case_020.txt, case_021.txt, case_022.txt, case_023.txt, case_024.txt, case_025.txt, case_026.txt, case_027.txt, case_028.txt, case_029.txt, case_030.txt, case_031.txt, case_032.txt, case_033.txt, case_034.txt, case_035.txt, case_036.txt, case_037.txt, case_038.txt, case_039.txt, case_040.txt, case_041.txt, case_042.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
case_000.txt | WA | 1 ms | 256 KB |
case_001.txt | WA | 1 ms | 256 KB |
case_002.txt | WA | 1 ms | 256 KB |
case_003.txt | WA | 1 ms | 256 KB |
case_004.txt | WA | 1 ms | 256 KB |
case_005.txt | WA | 1 ms | 256 KB |
case_006.txt | WA | 1 ms | 256 KB |
case_007.txt | WA | 1 ms | 256 KB |
case_008.txt | WA | 1 ms | 256 KB |
case_009.txt | WA | 1 ms | 256 KB |
case_010.txt | WA | 1 ms | 256 KB |
case_011.txt | WA | 1 ms | 256 KB |
case_012.txt | WA | 1 ms | 256 KB |
case_013.txt | WA | 1 ms | 256 KB |
case_014.txt | WA | 1 ms | 256 KB |
case_015.txt | WA | 1 ms | 256 KB |
case_016.txt | WA | 1 ms | 256 KB |
case_017.txt | WA | 1 ms | 256 KB |
case_018.txt | WA | 1 ms | 256 KB |
case_019.txt | WA | 1 ms | 256 KB |
case_020.txt | WA | 1 ms | 256 KB |
case_021.txt | WA | 1 ms | 256 KB |
case_022.txt | WA | 1 ms | 256 KB |
case_023.txt | WA | 1 ms | 256 KB |
case_024.txt | WA | 1 ms | 256 KB |
case_025.txt | WA | 1 ms | 256 KB |
case_026.txt | WA | 1 ms | 256 KB |
case_027.txt | WA | 1 ms | 256 KB |
case_028.txt | WA | 1 ms | 256 KB |
case_029.txt | WA | 1 ms | 256 KB |
case_030.txt | WA | 1 ms | 256 KB |
case_031.txt | WA | 1 ms | 256 KB |
case_032.txt | WA | 1 ms | 256 KB |
case_033.txt | WA | 1 ms | 256 KB |
case_034.txt | WA | 1 ms | 256 KB |
case_035.txt | WA | 1 ms | 256 KB |
case_036.txt | WA | 1 ms | 256 KB |
case_037.txt | WA | 1 ms | 256 KB |
case_038.txt | WA | 1 ms | 256 KB |
case_039.txt | WA | 1 ms | 256 KB |
case_040.txt | WA | 1 ms | 256 KB |
case_041.txt | WA | 1 ms | 256 KB |
case_042.txt | WA | 1 ms | 256 KB |