hdu acmsteps 2.1.8 Leftmost Digit】的更多相关文章

Leftmost Digit Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 1982 Accepted Submission(s): 884 Problem Description Given a positive integer N, you should output the leftmost digit of N^N. Input T…
传送门 Leftmost Digit Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 15305    Accepted Submission(s): 5937 Problem Description Given a positive integer N, you should output the leftmost digit of N…
1060 - Leftmost Digit 1601 - Rightmost Digit 1060题意很简单,求n的n次方的值的最高位数,我们首先设一个数为a,则可以建立一个等式为n^n = a * 10^x;其中x也是未知的: 两边取log10有:lg(n^n) = lg(a * 10^x); 即:n * lg(n)  - x = lg(a); 现在就剩x一个变量了,我们知道x是值n^n的位数-1,a向下取整就是我们要求的数: 所以 按着上面的推导式翻译成代码就可以了(注意:数值的范围和之间的…
Leftmost Digit Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 21744    Accepted Submission(s): 8408 Problem Description Given a positive integer N, you should output the leftmost digit of N^N.…
Leftmost Digit Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 20361    Accepted Submission(s): 7864 Problem Description Given a positive integer N, you should output the leftmost digit of N^N.…
Given a positive integer N, you should output the leftmost digit of N^N.  InputThe 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…
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.…
Leftmost Digit Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 14954    Accepted Submission(s): 5775 Problem Description Given a positive integer N, you should output the leftmost digit of N^N.…
HDU ACM-Steps RECORD Chapter 1 Section 1 暖手题 1.1.1 A+B for Input-Output Practice (I) #include <stdio.h> int main() { int a,b; while(scanf("%d %d",&a,&b)==2) printf("%d\n",a+b); return 0; } 1.1.2 A+B for Input-Output Pract…
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…
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 ca…
Leftmost Digit Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 16762    Accepted Submission(s): 6643 Problem Description Given a positive integer N, you should output the leftmost digit of N^N.…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1060 问题描述 给定一个正整数N,你应该输出N ^ N的最左边的数字. 输入 输入包含多个测试用例. 输入的第一行是单个整数T,它是测试用例的数量. T测试用例如下. 每个测试用例都包含一个正整数N(1 <= N <= 1,000,000,000). 输出  对于每个测试用例,您应该输出N ^ N的最左边的数字. 示例输入 2 3 4 示例输出 2 2 暗示:在第一种情况下,3 * 3 * 3 =…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1060   这道题运用的是数学方法. 假设S=n^n.两边同时取对数,得到lgS=nlgn.即有S=10^(nlgn). 把nlgn看做一个整体,假设它是由整数加上介于0到1之间的小数相加得到的. 那么整数部分就不考虑了,就单纯的放大倍数而已.取决于小数部分. 小数部分=nlgn-(__int64)nlgn.注意是__int64.因为小数部分在0到1之间,所以10得次方得到的数必定大于等于1且小于10…
基本思路:(参考大神和加自己的思考) 考虑到此题需要输入这么大的数a,并且还的求aa,求出来会更大,更多位.当时考虑用大数方法求(数组实现),结果实现不行.看网上大神采用对数法,巧妙避开处理这么大的数. 这就是数学的魅力!! 假如aa=b,两边同时取对数alog10a=log10b,从而有b=10alog10a.现在我们关注点在10alog10a,先举例:一个数2310,这个数,换成10c次幂,这里的c=3.xxxxx.如果把他取整一定为3,103是最大的权值,那剩下的100.xxxxx取整之后…
题意:给定一个数n,让你求出n的n次方的第一位数. 析:一看这个n快到int极限了,很明显不能直接做,要转化一下.由于这是指数,我们可以把指数拿下来. 也就是取对数,设ans = n ^ n,两边取以10为底对数 lg(ans) = n * lg(10),然后这个整数部分都是10的多次方, 没什么用,也就是说我们要的小数部分,然后再取指数,就OK了.还要注意要用long long因为可能超int了,第一次忘了,WA了. 代码如下: #include <iostream> #include &l…
Fibonacci Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2087 Accepted Submission(s): 999 Problem Description 2007年到来了.经过2006年一年的修炼,数学神童zouyu终于把0到100000000的Fibonacci数列 (f[0]=0,f[1]=1;f[i] = f[i-1…
Cake Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1815 Accepted Submission(s): 862 Problem Description 一次生日Party可能有p人或者q人参加,现准备有一个大蛋糕.问最少要将蛋糕切成多少块(每块大小不一定相等),才能使p人或者q人出席的任何一种情况,都能平均将蛋糕分食. Input…
问题描述: AC源码: 解题关键是,数据很大,不能强算,需要使用技巧,这里使用科学计算法,令N^N=a*10^n ,取对数后变为 N*log10(N)=log10(a)+n,令x = log10(a)+n  又 n = int(x)  [取整,当然根据所给数据范围,为了避免溢出,这是使用的是long long取整],则 a = 10^(x - int(x)),最后带入x= N*log10(N),对a的值取整即为最终结果. #include"iostream" #include"…
Leftmost Digit Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 12229    Accepted Submission(s): 4674题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1060 Problem Description Given a positive integ…
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=1195 Open the Lock Description Now an emergent task for you is to open a password lock. The password is consisted of four digits. Each digit is numbered from 1 to 9. Each time, you can add or minus 1 to…
HDU 1000 A + B Problem  I/O HDU 1001 Sum Problem  数学 HDU 1002 A + B Problem II  高精度加法 HDU 1003 Maxsum  贪心 HDU 1004 Let the Balloon Rise  字典树,map HDU 1005 Number Sequence  求数列循环节 HDU 1007 Quoit Design  最近点对 HDU 1008 Elevator  模拟 HDU 1010 Tempter of th…
转载:from http://blog.csdn.net/qq_28236309/article/details/47818349 基础题:1000.1001.1004.1005.1008.1012.1013.1014.1017.1019.1021.1028.1029. 1032.1037.1040.1048.1056.1058.1061.1070.1076.1089.1090.1091.1092.1093. 1094.1095.1096.1097.1098.1106.1108.1157.116…
Fibonacci Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Problem Description 2007年到来了.经过2006年一年的修炼,数学神童zouyu终于把0到100000000的Fibonacci数列 (f[0]=0,f[1]=1;f[i] = f[i-1]+f[i-2](i>=2))的值全部给背了下来. 接下来,CodeStar决定要考考他,于是每问他一…
Open the Lock Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3847    Accepted Submission(s): 1661 Problem Description Now an emergent task for you is to open a password lock. The password is co…
  Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 11011 Accepted Submission(s): 4214 Problem Description Given a positive integer N, you should output the leftmost digit of N^N. Input The input co…
Leftmost Digit Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 11600    Accepted Submission(s): 4430 Problem Description Given a positive integer N, you should output the leftmost digit of N^N.…
Open the Lock Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3388    Accepted Submission(s): 1499 Problem Description Now an emergent task for you is to open a password lock. The password is co…
Open the Lock Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5970    Accepted Submission(s): 2666 Problem Description Now an emergent task for you is to open a password lock. The password is co…
Open the Lock Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 6016    Accepted Submission(s): 2680 Problem Description Now an emergent task for you is to open a password lock. The password is c…