#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
int main () {
char a[10];
char tran[26] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',//9
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',//9
'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};//8
int fer[26] = {10, 11, 12, 13, 14, 15, 16, 17, 34, //9
18, 19, 20, 21, 22, 35, 23, 24, 25, //9
26, 27, 28, 29, 30, 31, 32, 33};//8
int b[10];
int total = 0;
scanf("%s", &a);
for (int d = 0; d <= 25; d++) {
if(a[0] == tran[d]) {
b[0] = fer[d];
break;
}
}
for (int c = 1; c <= 9; c++) {
b[c] = a[c] - 48;
}
for (int i = 8; i >= 1; i--) {
total = total + b[i] * (9 - i);
}
total = total + b[9];
total = total + (b[0] % 10) * 9;
total = total + (b[0] - b[0] % 10) / 10;
if (total % 10 == 0) {
printf("real");
}else {
printf("fake");
}
return 0;
}
#include
#include
#include
#include
int main () {
char a[10];
char tran[26] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',//9
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',//9
'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};//8
int fer[26] = {10, 11, 12, 13, 14, 15, 16, 17, 34, //9
18, 19, 20, 21, 22, 35, 23, 24, 25, //9
26, 27, 28, 29, 30, 31, 32, 33};//8
int b[10];
int total = 0;
scanf("%s", &a);
for (int d = 0; d <= 25; d++) {
if(a[0] == tran[d]) {
b[0] = fer[d];
break;
}
}
for (int c = 1; c <= 9; c++) {
b[c] = a[c] - 48;
}
for (int i = 8; i >= 1; i--) {
total = total + b[i] * (9 - i);
}
total = total + b[9];
total = total + (b[0] % 10) * 9;
total = total + (b[0] - b[0] % 10) / 10;
if (total % 10 == 0) {
printf("real");
}else {
printf("fake");
}
return 0;
}
W, X, Y錯了
W=32
X=30
Y=31
#include
#include
#include
#include
int main () {
char a[10];
char tran[26] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',//9
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',//9
'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};//8
int fer[26] = {10, 11, 12, 13, 14, 15, 16, 17, 34, //9
18, 19, 20, 21, 22, 35, 23, 24, 25, //9
26, 27, 28, 29, 30, 31, 32, 33};//8
int b[10];
int total = 0;
scanf("%s", &a);
for (int d = 0; d <= 25; d++) {
if(a[0] == tran[d]) {
b[0] = fer[d];
break;
}
}
for (int c = 1; c <= 9; c++) {
b[c] = a[c] - 48;
}
for (int i = 8; i >= 1; i--) {
total = total + b[i] * (9 - i);
}
total = total + b[9];
total = total + (b[0] % 10) * 9;
total = total + (b[0] - b[0] % 10) / 10;
if (total % 10 == 0) {
printf("real");
}else {
printf("fake");
}
return 0;
}
W, X, Y錯了
W=32
X=30
Y=31
喔喔原來是錯在這哈哈哈
謝謝!!!!