112345

wchzm 蛋仔派对 蛋小黑 2024-08-15 10:52:59 21

#include <bits/stdc++.h> using namespace std; int main() { int s; s = 0; int a[15]; int b[15]; for (int i = 1; i <= 10; i++) { cin >> a[i]; } for (int i = 1; i <= 10; i++) { b[i] = a[i] % 42; } for (int i = 1; i <= 10; i++) { for (int j = i + 1; j <= 10; j++) { if (b[i] == b[j]) { b[j] = -1; } } } for (int i = 1; i <= 10; i++) { if (b[i] != -1) s++; } cout << s; }

{{ vote && vote.total.up }}

共 2 条回复

wchzm 蛋仔派对 蛋小黑
#include <bits/stdc++.h> 
using namespace std; 
int main() { 
int s; 
s = 0; 
int a[15]; 
int b[15]; 
for (int i = 1; i <= 10; i++) { 
cin >> a[i]; 
} for (int i = 1; i <= 10; i++) { 
b[i] = a[i] % 42; } for (int i = 1; i <= 10; i++) { 
for (int j = i + 1; j <= 10; j++) { 
if (b[i] == b[j]) { b[j] = -1; } } } for (int i = 1; i <= 10; i++) { if (b[i] != -1) s++; 
} 
cout << s; }
Joshua Microsoft

???