This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdlib.h> | |
#include<string.h> | |
#include<math.h> | |
int main(){ | |
char str1[100],str2[100]; | |
scanf("%s%s",str1,str2); | |
int i=0; | |
for(i=0;i<strlen(str1);i++){ | |
if(str1[i]==(str2[i])||(abs((str1[i]-'0')-(str2[i]-'0'))>1&&abs((str1[i]-'0')-(str2[i]-'0'))!=4)) | |
printf("和"); | |
else if(abs((str1[i]-'0')-(str2[i]-'0'))==4){ | |
if(str1[i]-'0'>str2[i]-'0') | |
printf("輸"); | |
else | |
printf("贏"); | |
} | |
else{ | |
if(str1[i]-'0'>str2[i]-'0') | |
printf("贏"); | |
else | |
printf("輸"); | |
} | |
} | |
printf("\n"); | |
/*題目:C_AR94-易 洗刷刷 | |
作者:1010 | |
時間:西元 2017 年 4 月 7日*/ | |
} |
依照題意兩數相差大於1就是和還有一個例外就是1比5大其餘就按照比大小去比
注意!ITSA似乎不能接受JAVA國字的題目(使用萬國碼也無法AC)
沒有留言:
張貼留言