【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的最左边的数字. 输入 输入包含多个测试用例. ...
随机推荐
- Delphi Dll 消息处理
转载:http://blog.csdn.net/lailai186/article/details/8770643 事情的导火线是GIF图片的显示. 在应用程序中, 利用三方的GIFImage.pas ...
- Codeforces 566 D. Restructuring Company
Description 一开始有 \(n\) 个元素,可以进行几个操作. 合并 \(x,y\) . 合并 \(x,x+1,...,y\) . 询问 \(x,y\) 是否在一个集合中. Sol 并查集+ ...
- python对象的生命周期
引言 碰到以下问题: 代码1: from Tkinter import * root = Tk() photo = PhotoImage(file=r'E:\workspace\python\111. ...
- sublime配置markdown
1.安装sublime 2.安装package control 3.ctrl+shift+P输入install进入Install Packages 4.安装markdown preview 5.配置删 ...
- 页面加载时执行JQ代码
$(function () { //jq加载时执行的这里面是 $("#ss").append("<strong>这是新加的</strong>&qu ...
- kendoUI grid 过滤时出错:TypeError toLowerCase is not a function
错误原因:类型不一致. 有些过滤类型为字符串,有些为整型时.
- Unity3d 换装Avatar系统
原理就是用新造的部件和角色的骨骼进行重新对接. demo的使用方法: PartIdx设置要换那个部件[0,4],一共5个部件 EquipIdx设置要更换部件的装备索引[0,1],具体看我的Change ...
- [Linux]centOS7-1-1503-x86_64下安装VM-TOOLS
1.安装Perl. 2.如果提示 The path "" is not a valid path to the 3.10.0-229.el7.x86_64 kernel heade ...
- win7,ubuntu双系统——重装win7后如何恢复ubuntu引导
磁盘分区——windows 7自带分区工具实现 磁盘分区——PQ硬盘分区魔术师 win7,ubuntu双系统的安装——正式安装 win7,ubuntu双系统的安装——卸载ubuntu 讲述了我的 w ...
- css 自动换行 [英文、数字、中文]
white-space:normal;overflow: auto;table-layout:fixed; word-break: break-all;