博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
HDU 1060 Leftmost Digit【log10/求N^N的最高位数字是多少】
阅读量:4678 次
发布时间:2019-06-09

本文共 1200 字,大约阅读时间需要 4 分钟。

Leftmost Digit

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)

Total Submission(s): 19010    Accepted Submission(s): 7507

Problem Description
Given a positive integer N, you should output the leftmost digit of N^N.
 

 

Input
The input contains several test cases. The first line of the input is a single integer T which is the number of test cases. T test cases follow.
Each test case contains a single positive integer N(1<=N<=1,000,000,000).
 

 

Output
For each test case, you should output the leftmost digit of N^N.
 

 

Sample Input
2 3 4
 

 

Sample Output
2 2
Hint
In the first case, 3 * 3 * 3 = 27, so the leftmost digit is 2. In the second case, 4 * 4 * 4 * 4 = 256, so the leftmost digit is 2.
 

 

Author
Ignatius.L
【分析】:
【代码】:
#include 
using namespace std;typedef long long LL;const int MOD = 7;typedef vector
vec;typedef vector
mat;int main(){ int n,t,ans; double tmp; cin>>t; while(t--){ cin>>n; tmp=n*log10(1.0*n); tmp=tmp-(__int64)tmp; ans=(int)(pow(10.0,tmp)); printf("%d\n",ans); } return 0;}
数论

 

转载于:https://www.cnblogs.com/Roni-i/p/8351572.html

你可能感兴趣的文章
单页面应用程序(SPA)的优缺点
查看>>
http请求和http响应详细解析
查看>>
Centos 配置eth0 提示Device does not seem to be present
查看>>
OS开发入门教程(1)
查看>>
arduino 驱动电调
查看>>
一个游标的性能问题
查看>>
JMeter学习-2 JMeter环境搭建
查看>>
SQL SERVER 2012疑难问题解决方法
查看>>
关于Android RenderScript 的详细说明和一些实用文档
查看>>
POJ1051 P,MTHBGWB
查看>>
士兵队列训练问题
查看>>
播放器
查看>>
linq to entity GroupBy多个字段
查看>>
二叉树遍历 空间复杂度为O(1)
查看>>
关于排序
查看>>
bzoj 3874: [Ahoi2014&Jsoi2014]宅男计划
查看>>
记录-Hibernate+servlet实现简单的增、删、查、改
查看>>
用位运算生成下一个含有k个1的二进制数
查看>>
setContentView()与LayoutInflater.inflate()作用
查看>>
Java魔法堂:注解用法详解——@SuppressWarnings
查看>>