Submission #4046715
Source Code Expand
#include<iostream> using namespace std; int f[105],n; string a; inline int mn(int x,int y) { if (x<y) return x; else return y; } int main() { cin>>n; cin>>a; f[0]=(a[0]=='X'); f[1]=(a[1]=='X'); f[2]=(a[2]=='X'); for (int i=3;i<n;i++) f[i]=(a[i]=='X')+mn(f[i-3],mn(f[i-2],f[i-1])); cout<<f[n-1]; return 0; } f[0]=(a[0]=='X'); f[1]=(a[1]=='X'); f[2]=(a[2]=='X'); for (int i=3;i<n;i++) f[i]=(a[i]=='X')+mn(f[i-3],mn(f[i-2],f[i-1])); cout<<f[n-1]; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - 雨上がり |
User | luogu_bot1 |
Language | C++ (GCC 5.4.1) |
Score | 0 |
Code Size | 477 Byte |
Status | CE |
Compile Error
./Main.cpp:25:2: error: ‘f’ does not name a type f[0]=(a[0]=='X'); ^ ./Main.cpp:26:2: error: ‘f’ does not name a type f[1]=(a[1]=='X'); ^ ./Main.cpp:27:2: error: ‘f’ does not name a type f[2]=(a[2]=='X'); ^ ./Main.cpp:28:2: error: expected unqualified-id before ‘for’ for (int i=3;i<n;i++) ^ ./Main.cpp:28:15: error: ‘i’ does not name a type for (int i=3;i<n;i++) ^ ./Main.cpp:28:19: error: ‘i’ does not name a type for (int i=3;i<n;i++) ^ ./Main.cpp:30:2: error: ‘cout’ does not name a type cout<<f[n-1]; ^ ./Main.cpp:31:2: error: expected unqualified-id before ‘return’ return 0; ^ ./Main.cpp:32:1: error: expected declaration before ‘}’ token } ^