網路城邦
上一篇 回創作列表 下一篇   字體:
UVa 10162 cpp
2025/01/19 12:47:09瀏覽50|回應0|推薦1

#include <cstdlib>

#include <cstring>

#include <cstdio>

#include <string>

using namespace std;
int maps[20] = {
 0,1,5,2,8,3,9,2,8,7,
 7,8,4,7,3,8,4,1,5,4};
 
int main()
{
  string str;
  while( cin >> str) {
    int len = str.length();
if (len == 1 && str[0] == 0 )
   break;
int value = str[len-1]-0;
if ( len > 1 ) {
value += (str[len-2]-0)*10;
}
cout << (maps[value%20] + (value/20)*4)%10 << endl;
  }
  return 0;
}
( 知識學習考試升學 )
回應 推薦文章 列印 加入我的文摘
上一篇 回創作列表 下一篇

引用
引用網址:https://classic-blog.udn.com/article/trackback.jsp?uid=aabbcc1&aid=181688356