hdu 1060

题目概述:

有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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值