题目概述:
有times组数据
一个数n
输入:
第一行times,其后times行,每行n
输入有多组
限制:
1<=n<=1e9
输出:
每行一个整数,n的n次方的第一位有效数字
多组输出之间没有空行
样例输入:
2
3
4
样例输出:
2
2
讨论:
就是个公式,死记硬背而已
题解状态:
0MS,1820K,497 B,C++
#include<algorithm>
#include<string.h>
#include<stdio.h>
#include<iostream>
using namespace std;
#define INF 0x3f3f3f3f
#define maxx(a,b) ((a)>(b)?(a):(b))
#define minn(a,b) ((a)<(b)?(a):(b))
#define MAXN 205
int main(void)
{
//freopen("vs_cin.txt", "r", stdin);
//freopen("vs_cout.txt", "w", stdout);
int times;
cin >> times;//input
while (times--) {
double n;
while (cin >> n) {//input
cout << floor(pow(10, (n*log10(n) - floor(n*log10(n))))) << endl;//output
}
}
}
EOF