Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //#30
- #include <iostream>
- using namespace std;
- void fillArray(int *massiv, int razmer)
- {
- for(int i = 0; i < razmer; i++){
- cin >> massiv[i];
- }
- }
- bool isDifferent(int a)
- {
- if(a / 10 == 0){
- return false;
- }
- int arr[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
- while(a != 0){
- arr[a % 10]++;
- a /= 10;
- }
- for(int i = 0; i < 10; i++){
- if(arr[i] > 1){
- return false;
- }
- }
- return true;
- }
- int main()
- {
- int n, m;
- cin >> n >> m;
- int X[n], Y[m];
- fillArray(&X[0], n);
- fillArray(&Y[0], m);
- int cntOne = 0, cntTwo = 0;
- for(int i = 0; i < n; i++){
- if(isDifferent(X[i]) == true){
- cntOne++;
- }
- }
- for(int i = 0; i < m; i++){
- if(isDifferent(Y[i]) == true){
- cntTwo++;
- }
- }
- if(cntOne > cntTwo){
- cout << "X WIN!";
- }
- if(cntOne < cntTwo){
- cout << "Y WIN!";
- }
- if(cntOne == cntTwo){
- cout << "Draw >_<";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment