样例过了全wa,!大佬看看吧
查看原帖
样例过了全wa,!大佬看看吧
892700
elong123楼主2024/3/27 22:20
#include<iostream>
using namespace std;
int sub[8]={0},mysub[10000];
int price[1024]={0};
int n,s,my,ans;
int main(){
		cin >> n;
		for(int i =0; i < 7; i++){
			cin >> s;
			sub[i] = s; //彩票数组
		}
		while(n--){
			for(int j =0; j < 7 ;j++){
				cin >> my;//我的号码
				for(int i =0; i < 7; i++){
					if(my == sub[i])
					ans++;
				}
			}
		//	cout << ans <<endl;
			if(ans == 7) price[0]++;
			else if(ans == 6) price[1]++;
			else if(ans == 5) price[2]++;
			else if(ans == 4) price[3]++;
			else if(ans == 3) price[4]++;
			else if(ans == 2) price[5]++;
			else if(ans == 1) price[6]++;
			ans = 0;
		}
		for(int i =0; i < 7; i++)
			cout << price[i];
		return 0;
}

实在想不出来哪里有问题,数组每页也开最大不见过...

2024/3/27 22:20
加载中...