本文主要是介绍hud 1061Rightmost Digit,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
/........................................................................................................................................\
打表找规律,
m = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 27 28 29 30 31 ...
i = 1 4 7 6 5 6 3 6 9 0 1 6 3 6 5 6 7 4 9 0 1 4 7 6 5 6 3 6 9 0 ...
很明显是以20为周期的函数。
\......................................................................................................................................../
#include<stdio.h>
#include <iostream>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<algorithm>
#include<list>
#include<vector>
#pragma comment(linker,"/STACK:102400000,102400000")
using namespace std;int main(){int n,t;int a[24]={0,1,4,7,6,5,6,3,6,9,0,1,6,3,6,5,6,7,4,9,0};scanf("%d",&t);while(t--){scanf("%d",&n);int m=n%20;printf("%d\n",a[m]);}return 0;}
这篇关于hud 1061Rightmost Digit的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!