|
|
back to boardThis is my code in c++ .Why got WR 3 #include<iostream> #include<string> using namespace std; int main(){ int line=1,liner,start=0,paper=1,word,symbol; cin>>liner>>symbol>>word; for(int i=0;i<word;i++){ string s; cin>>s; int a; if(start==0) a=s.size(); else a=s.size()+1; if((start+a)<symbol) start=start+a; else { start=0; line++;} } if(line%liner==0) cout<<(line/liner); else cout<<(line/liner+1); system("pause"); return 0; } |
|
|