【hdu 1060】【求N^N最低位数字】
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
Each test case contains a single positive integer N(1<=N<=1,000,000,000).
3
4
2
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.
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int sum;
while(cin>>sum)
{
while(sum--)
{
double n;
scanf("%lf",&n);
double x=n*log10(n*1.0);
_int64 y=(_int64)x;
double xy=x-y;
int temp=(int)pow(10.0,xy);
printf("%d\n",temp);
}
}
return ;
}
【hdu 1060】【求N^N最低位数字】的更多相关文章
- HDU 5230 ZCC loves hacking 大数字的整数划分
http://acm.hdu.edu.cn/showproblem.php?pid=5230 把题目简化后,就是求 1---n - 1这些数字中,将其进行整数划分,其中整数划分中不能有重复的数字,如果 ...
- shelll函数求两个输入数字之和
#!/bin/bash #This is a test of the addition of the program! function AddFun { read -p "Enter a ...
- 面试题:m个长度为n的ordered array,求top k 个 数字
package com.sinaWeibo.interview; import java.util.Comparator; import java.util.Iterator; import java ...
- 【C语言】输入一组整数,求出这组数字子序列和中最大值
//输入一组整数.求出这组数字子序列和中最大值 #include <stdio.h> int MAxSum(int arr[],int len) { int maxsum = 0; int ...
- 用java求一个整数各位数字之和
/* * 用java求一个整数各位数字之和 */ public class Test02 { public static void main(String[] args) { System.out.p ...
- HDU 1060 Leftmost Digit(求N^N的第一位数字 log10的巧妙使用)
Leftmost Digit Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)To ...
- HDU 1060 Leftmost Digit【log10/求N^N的最高位数字是多少】
Leftmost Digit Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)To ...
- 区间求小于等于k的数字个数 hdu4177
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4417 题目意思给出一个序列,叫我们求一个区间里面小于等于k的数字个数. 这里面我用分块和主席树两种方法 ...
- 题解报告:hdu 1060 Leftmost Digit
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1060 问题描述 给定一个正整数N,你应该输出N ^ N的最左边的数字. 输入 输入包含多个测试用例. ...
随机推荐
- 使用shell脚本自动化对硬盘进行分区
在Linux系统中,可以使用fdisk 对硬盘进行分区,但是要手动执行很多命令,这样使用有很麻烦,现在记一个用fdisk 的脚本自动执行. #make partition dd count= fdis ...
- Linux Ruijie登录命令
cd rjsupplicant chmod +x rjsupplicant.sh sudo ./rjsupplicant.sh -u 1550590×××× -p ××××× -d 1
- JS插件之——ztree
很牛逼的一个树形菜单,树形下拉框插件.一年前用过,很好用.今天又有机会拿过来用,温故一下基本点,nice!! 官方文档说明的非常详细,按照API慢慢看,耐心解读,自然就可以解惑了. 官方文档及其源码下 ...
- Random Pick Index
Given an array of integers with possible duplicates, randomly output the index of a given target num ...
- 学 Redux (转)
0.官方文档:http://redux.js.org/ 中文版本 : http://cn.redux.js.org/ 中文版本(好!): http://www.css88.com/react/d ...
- POJ 1190(深搜)
http://poj.org/problem?id=1190 又有好久没做搜索的题了,没想到做一个卡了我那么久,想哭啊. 一个中文题,思路呢也就是搜索呗,一层一层往上面搜,不过这里有两个比较重要的地方 ...
- Python中下划线的使用方法
本文将讨论Python中下划线(_)字符的使用方法.我们将会看到,正如Python中的很多事情,下划线的不同用法大多数(并非所有)只是常用惯例而已. 单下划线(_) 通常情况下,会在以下3种场景中使用 ...
- c++ template
在类中其中一个函数使用模板,函数定义和实现必须放在头文件里. ca.h template<typename T> void swap2(T &a,T &b) { T c=a ...
- MyISAM 调度(优先级)的一些优化【转】
MySQL的MyISAM引擎现在越来越被淡化了,但是还是有必要再温习总结一下的. 允许你改变语句调度的优先级,它可以使来自多个客户端的查询更好地协作,这样单个客户端就不会由于锁定而等待很长时间.改变优 ...
- winrt获取文件MD5码
//小文件 public static string ComputeMD5(byte[] bytes) { var alg = HashAlgorithmProvider.OpenAlgorithm( ...