- 【Level 1 语法基础课】检验赛2
111
- 2024-2-1 20:40:17 @
#include<bits/stdc++.h>
using namespace std;
char a;
int shiyi,ershiyi,shiyiduishou,ershiyiduishou,ershiyijifen[1000010],ershiyiduishoujifen[1000010],o=1,ershiyijieguo,ershiyiduishoujieguo,shiyijieguo,shiyiduishoujieguo;
int main()
{
while(a!='E')
{
cin >> a ;
if(a=='W') shiyi++,ershiyi++;
if(a=='L') shiyiduishou++,ershiyiduishou++;
if(shiyi>=11&&shiyi-shiyiduishou>=2)
{
cout << shiyi << ':' << shiyiduishou << endl ;
shiyi=0,shiyiduishou=0;
shiyijieguo++;
}
if(shiyiduishou>=11&&shiyiduishou-shiyi>=2)
{
cout << shiyi << ':' << shiyiduishou << endl ;
shiyi=0,shiyiduishou=0;
shiyiduishoujieguo++;
}
if(ershiyi>=21&&ershiyi-ershiyiduishou>=2)
{
ershiyijifen[o]=ershiyi;
ershiyiduishoujifen[o]=ershiyiduishou;
ershiyijieguo++,o++;
ershiyi=0,ershiyiduishou=0;
}
if(ershiyiduishou>=21&&ershiyiduishou-ershiyi>=2)
{
ershiyijifen[o]=ershiyi;
ershiyiduishoujifen[o]=ershiyiduishou;
ershiyiduishoujieguo++,o++;
ershiyi=0,ershiyiduishou=0;
}
}
cout << shiyijieguo << ':' << shiyiduishoujieguo << endl ;
for(int i=1;i<o;i++) cout << ershiyijifen[i] << ':' << ershiyiduishoujifen[i] << endl;
cout << ershiyijieguo << ':' << ershiyiduishoujieguo ;
return 0;
}
3 comments
-
Steven Wang 状元 LV 9 @ 2024-2-1 21:28:38
#include<bits/stdc++.h> using namespace std; int a,b; long long c=1 ; int main() { cin >> a >> b ; if(a==1) { cout << 1 ; return 0; } for(int i=1;i<=b;i++) { c*=a; if(c>1000000000) { cout << -1 ; return 0; } } cout << c ; return 0; }
-
2024-2-1 21:28:16@
#include<bits/stdc++.h> using namespace std; char z[110][110]; int m,n; int foo(int x,int y) { int a=0; for(int i=x-1;i<=x+1;i++) for(int j=y-1;j<=y+1;j++) if(z[i][j]=='*') a++; return a; } int main() { cin >> n >> m ; for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) cin >> z[i][j] ; for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) { if(z[i][j]=='*') cout << '*' ; else cout << foo(i,j); } cout << endl ; } return 0; }
-
2024-2-1 21:22:46@
#include<bits/stdc++.h> using namespace std; char a; int shiyi,ershiyi,shiyiduishou,ershiyiduishou,ershiyijifen[1000010],ershiyiduishoujifen[1000010],o=1,ershiyijieguo,ershiyiduishoujieguo,shiyijieguo,shiyiduishoujieguo; int main() { for(;a!='E';) { cin >> a ; if(a=='W') shiyi++,ershiyi++; if(a=='L') shiyiduishou++,ershiyiduishou++; if(shiyi>=11&&shiyi-shiyiduishou>=2) { cout << shiyi << ':' << shiyiduishou << endl ; shiyi=0,shiyiduishou=0; shiyijieguo++; } if(shiyiduishou>=11&&shiyiduishou-shiyi>=2) { cout << shiyi << ':' << shiyiduishou << endl ; shiyi=0,shiyiduishou=0; shiyiduishoujieguo++; } if(ershiyi>=21&&ershiyi-ershiyiduishou>=2) { ershiyijifen[o]=ershiyi; ershiyiduishoujifen[o]=ershiyiduishou; ershiyijieguo++,o++; ershiyi=0,ershiyiduishou=0; } if(ershiyiduishou>=21&&ershiyiduishou-ershiyi>=2) { ershiyijifen[o]=ershiyi; ershiyiduishoujifen[o]=ershiyiduishou; ershiyiduishoujieguo++,o++; ershiyi=0,ershiyiduishou=0; } } cout << shiyi << ':' << shiyiduishou << endl ; for(int i=1;i<o;i++) cout << ershiyijifen[i] << ':' << ershiyiduishoujifen[i] << endl; cout << ershiyi << ':' << ershiyiduishou << endl ; return 0; }
- 1