解法:
手动本地跑了一下1e9,显然超时。
然后预处理发现开不了这么大的数组。
肯定有规律,打表看看
代码如下
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
#define endl '\n'
int main()
{
int n;
while (cin >> n && n != -1) {
if (n == 0) {
cout << 0 << 1 << endl;
}
else if (n == 1) {
cout << 0 << 6 << endl;
}
else if (n <= 6) {
switch (n) {
case 2:cout << 36 << endl; break;
case 3:cout << 16 << endl; break;
case 4:cout << 96 << endl; break;
case 5:cout << 76 << endl; break;
case 6:cout << 56 << endl; break;
}
}
else {
switch (n%5) {
case 2:cout << 36 << endl; break;
case 3:cout << 16 << endl; break;
case 4:cout << 96 << endl; break;
case 0:cout << 76 << endl; break;
case 1:cout << 56 << endl; break;
default:break;
}
}
}
/*0-1
1-6
2-36 7 12
3-16 8 13
4-96 9 14
5-76 10 15
6-56 11 16*/
return 0;
}