d.cpp
来自「The 5th Annual Shantou Univ.Collegiage P」· C++ 代码 · 共 44 行
CPP
44 行
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream input_file;
input_file.open("Ray's Problem's input.txt");
ofstream output_file;
output_file.open("Ray's Problem's output.txt");
int x[10][10]=
{{1, 0},
{1, 1},
{4, 2, 4, 8, 6},
{4, 3, 9, 7, 1},
{2, 4, 6},
{1, 5},
{1, 6},
{4, 7, 9, 3, 1},
{4, 8, 4, 2, 6},
{2, 9, 1}};
int n, a, b;
input_file >> n;
while (n--)
{
int a, b;
input_file >> a >> b;
if (b==0)
output_file << 1 << endl;
else
{
a%=10;
b%=x[a][0];
if (b==0)
output_file << x[a][x[a][0]] << endl;
else output_file << x[a][b] << endl;
}
}
input_file.close();
output_file.close();
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?