Submission #3098097
Source Code Expand
int replace(int N,char* str){ int ret = 4; char ijpc[] = "IJPC"; for(int s=0;s<(1<<4);++s){ int pos = 0; bool flag = true; for(int k=0;k<4;++k){ if(s&(1<<k) ){ flag = false; while(pos<N){ if(str[pos] == ijpc[k] ){ flag = true; ++pos; break; } ++pos; } if( flag == false ){ break; } }else{ pos++;//入れ替えように一文字欲しい } } if( flag == true && pos <=N ){ int res = 4; for(int k=0;k<4;++k){ if(s&(1<<k)){ --res; } } if(ret>res){ ret = res; } } } return ret; }
Submission Info
Submission Time | |
---|---|
Task | A - 国際情報オリンピック日本代表プログラミングコンテスト (Welcome to IJPC) |
User | hehe1 |
Language | C++ (GCC 5.4.1) |
Score | 0 |
Code Size | 636 Byte |
Status | CE |
Compile Error
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 0 has invalid symbol index 11 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 1 has invalid symbol index 12 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 2 has invalid symbol index 2 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 3 has invalid symbol index 2 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 4 has invalid symbol index 11 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 5 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 6 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 7 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 8 has invalid symbol ...