刘宸志 CEUA • 2年前
using namespace std;
int a[3];
int main() {
for (int i = 0; i < 3; i++) {
cin >> a[i];
}
int z = a[0];
for (int i = 1; i < 3; i++) {
if (z < a[i]) {
z = a[i];
}
}
cout << z;
return 0;
}
评论:
using namespace std;
int main() {
freopen("coin.in", "r", stdin);
freopen("coin.out", "w", stdout);
int n, x = 0, a1, a2, b1, b2, b3, c1, c2, c3, d;
scanf("%d", &n);
if (n > 20) {
if (n % 20 == 0) {
a1 = n / 20;
x++;
printf("%d", a1);
printf(" %d", x);
return 0;
}
if (n % 20 != 0) {
a1 = n / 20;
a2 = n % 20;
x++;
}
}
if (a2 >= 10) {
if (a2 % 10 == 0) {
b1 = a1 + (a2 / 10);
x++;
printf("%d", b1);
printf(" %d", x);
return 0;
}
if (a2 % 10 != 0) {
b3 = a2 / 10;
b2 = a2 % 10;
x++;
}
}
if (b2 >= 5) {
if (b2 % 5 == 0) {
c1 = a1 + b3 + (b2 / 5);
x++;
printf("%d", c1);
printf(" %d", x);
return 0;
}
if (b2 % 5 != 0) {
c3 = b2 / 5;
c2 = b2 % 5;
x++;
}
}
if (c2 >= 1) {
d = a1 + b3 + c3 + (c2 / 1);
x++;
printf("%d", d);
printf(" %d", x);
return 0;
}
return 0;
}
int quan(int k) {
int b[17] = {7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2};
return b[k];
}
bool check(char n[]) {
for (int i = 0; i < 17; i++)
if (n[i] < '0' || n[i] > '9')
return 0;
int sum = 0;
for (int i = 0; i < 17; i++) {
n[i] = n[i] - '0';
sum += n[i] * quan(i);
}
int a = sum % 11;
char b[11] = {'1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'};
if (n[17] == b[a])
return 1;
else
return 0;
} using namespace std;
int main() {
int n;
cin >> n;
int d = 0;
string cun[101];
for (int i = 0; i < n; i++) {
string a;
char b[18];
cin >> a;
for (int j = 0; j < 18; j++) {
b[j] = a[j];
}
if (check(b) == 0) {
cun[d] = a;
d++;
}
}
if (d == 0)
cout << "All passed" ;
else
for (int i = 0; i < d; i++) {
cout << cun[i] << endl;
}
return 0;
}
请先登录,才能进行评论