只有一个点过了

P1223 排队接水

整数整除整数,出来还是整数,应该强转
by ToBeWonder @ 2019-06-09 15:12:26


@[Donaghy](/space/show?uid=203762)
by ToBeWonder @ 2019-06-09 15:13:18


@[baozige](/space/show?uid=117299) 哦,谢谢dalao
by Donaghy @ 2019-06-09 15:30:33


AC了
by Donaghy @ 2019-06-09 15:33:57


十分感谢
by Donaghy @ 2019-06-09 15:34:13


#include<bits/stdc++.h> using namespace std; int main() { bool b=0; char ch1[10],ch2[1000000]; int n,t=0; cin>>ch1>>ch2; for (int i=0;i<strlen(ch1);i++) { if (ch1[i]>='A'&&ch1[i]<='Z') ch1[i]=ch1[i]+32; } for (int i=0;i<strlen(ch2);i++) { if (ch2[i]>='A'&&ch2[i]<='Z') ch2[i]=ch2[i]+32; } for (int i=0;i<strlen(ch2);i++) { if ((ch2[i-1]==' '&&ch2[i+strlen(ch1)]==' ')||(i==0&&ch2[i+strlen(ch1)]==' ')||(ch2[i-1]==' '&&ch2[i+strlen(ch1)]==strlen(ch2)-1)) { for (int j=0;j<strlen(ch1);j++) { b=0; if (ch1[j]!=ch2[i+j]) b=1;break; } if (t==0&&b==0) n=i,t++; else if(b==0) t++; } } if (t>0) cout<<t<<" "<<n; else cout<<"-1"; }
by 蒟蒻嘤嘤怪 @ 2019-06-14 17:38:12


|