0
已解决
The code:
#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
long long xh[101],xb[101],bs,hs,p;
int main(){
int n,h,b;
cin>>h>>b>>n;
for(int i=0;i<h;i++){
cin>>xh[i];
}
for(int i=0;i<b;i++){
cin>>xb[i];
}
for(int j=0;j<n;j++){
if(xh[j%h]>xb[j%h]){
hs++;
}
if(xh[j%h]<xb[j%h]){
bs++;
}
if(xh[j%h]==xb[j%h]){
p++;
}
}
cout<<hs<<" "<<bs<<" "<<p;
return 0;
}
https://newcourse.codingtang.com/#/problem/problemSub?id=3976
or
https://ke.codingtang.com/#/problem/problemSub?id=3976
0points
Help me!
李致远在2020-08-11 23:15:37追加了内容
#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
int xh[1001],xb[1001],bs,hs,p;
int main(){
int n,h,b;
cin>>h>>b>>n;
for(int i=0;i<h;i++){
cin>>xh[i];
}
for(int i=0;i<b;i++){
cin>>xb[i];
}
for(int j=0;j<n;j++){
if(xh[j%h]>xb[j%h]){
hs++;
}
if(xh[j%h]<xb[j%h]){
bs++;
}
if(xh[j%h]==xb[j%h]){
p++;
}
}
cout<<hs<<" "<<bs<<" "<<p;
return 0;
}
The Wrong Answer2...
李致远在2020-08-11 23:27:32追加了内容
我服你。。。
——————————
3976 比较数字
经验值:0
题目描述 Description
请你周期性比较两组数据的大小,例如给出如下两组数据:
A: 2 4 5 1
B: 8 1 2 3 1
那么当比较次数为10的时候,那么实际上是比较如下两组数据:
A: 2 4 5 1 2 4 5 1 2 4
B: 8 1 2 3 1 8 1 2 3 1
那么A>B的有5组数据,B>A的有5组数据,那么最后只需要输出5 5 0即可,分别表示A>B,B>A,A=B的数据组数。
输入描述 Input Description
第一行,两个正整数m,n,s,m,n分别表示A,B两组数据的周期(m,n均是小于1000的),s表示比较次数(s≤10000)
第二行,m个正整数,表示A组数据
第三行,n个正整数,表示B组数据
输出描述 Output Description
一行,三个正整数,分别表示A>B,B>A,A=B的数据组数
样例输入 Sample Input
4 5 10
2 4 5 1
8 1 2 3 1
样例输出 Sample Output
5 5 0
