認真發問

#include <iostream> #include <string.h> using namespace std; int table[2][10]={ {0,1,4,7,6,5,6,3,6,9 }, {0,1,6,3,6,5,6,7,4,9 } }; int main() { int ans,tens,len; char s[200]; while(cin>>s && !(s[0]=='0' && s[1]=='\0') ){ len=strlen(s); if(len>=2){tens=s[len-2]-'0';} else tens=0; ans= tens*47; for(int i=1;i<=s[len-1]-'0';i++){ ans=ans+table[tens%2][i]; } cout<<ans%10<<endl; } return 0; } 明天早餐吃啥? 睡了 晚安
愛心
4
12
全部留言