minor changes

This commit is contained in:
OliverLew
2017-05-04 01:24:57 +08:00
parent c3a9f66c8b
commit 79027e1c77
3 changed files with 6 additions and 9 deletions
+3 -6
View File
@@ -28,12 +28,9 @@ int main()
char c;
while((c = getchar()) != '\n')
{
switch(c)
{
case 'P': P++; break;
case 'A': PA = (PA + P) % LIM; break;
case 'T': PAT = (PAT + PA) % LIM; break;
}
if(c == 'P') P++;
if(c == 'A') PA = (PA + P) % LIM;
if(c == 'T') PAT = (PAT + PA) % LIM;
}
printf("%d", PAT);
return 0;
+2 -2
View File
@@ -24,7 +24,7 @@
int main()
{
char A[101], B[101];
char thirteen[13] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'J', 'Q', 'K'};
char encrypt[] = "0123456789JQK";
scanf("%s %s", A, B);
int lenA = strlen(A);
@@ -36,7 +36,7 @@ int main()
{
a = lenA + i - maxlen < 0 ? 0 : A[lenA + i - maxlen] - '0';
b = lenB + i - maxlen < 0 ? 0 : B[lenB + i - maxlen] - '0';
if((maxlen - i) % 2) putchar(thirteen[(a + b) % 13]);
if((maxlen - i) % 2) putchar(encrypt[(a + b) % 13]);
else putchar('0' + (b - a < 0 ? b - a + 10 : b - a));
}
+1 -1
View File
@@ -34,7 +34,7 @@ int main()
scanf("%lf", &ai);
sum += ai * (i + 1) * (N - i);
}
printf("%.2f", sum);
printf("%.2lf", sum);
return 0;
}