POJ 1001 Outout of limitt Exceeded

手把手教你使用poj_百度文库
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
评价文档:
喜欢此文档的还喜欢
手把手教你使用poj
阅读已结束,如果下载本文需要使用
想免费下载本文?
把文档贴到Blog、BBS或个人站等:
普通尺寸(450*500pix)
较大尺寸(630*500pix)
你可能喜欢热门日志推荐
人人最热标签
分享这篇日志的人常去
北京千橡网景科技发展有限公司:
文网文[号··京公网安备号·甲测资字
文化部监督电子邮箱:wlwh@··
文明办网文明上网举报电话: 举报邮箱:&&&&&&&&&&&&
请输入手机号,完成注册
请输入验证码
密码必须由6-20个字符组成
下载人人客户端
品评校花校草,体验校园广场1001 -- ExponentiationOnline JudgeProblem SetAuthorsOnline ContestsUserProb.ID:
Current ContestUser ID:Password:&&
Language:Default简体中文Exponentiation
Time Limit: 500MSMemory Limit: 10000KTotal Submissions: 143745Accepted: 35082DescriptionProblems involving the computation of exact values of very large magnitude and precision are common. For example, the computation of the national debt is a taxing experience for many computer systems.
This problem requires that you write a program to compute the exact value of Rn where R is a real number ( 0.0 < R < 99.999 ) and n is an integer such that 0 < n <= 25. InputThe input will consist of a set of pairs of values for R and n. The R value will occupy columns 1 through 6, and the n value will be in columns 8 and 9.OutputThe output will consist of one line for each line of input giving the exact value of R^n. Leading zeros should be suppressed in the output. Insignificant trailing zeros must not be printed. Don't print the decimal point if the result is an integer.Sample Input95.123 12
Sample Output.
1.HintIf you don't know how to determine wheather encounted the end of input:
s is a string and n is an integer
C++
while(cin>>s>>n)
{
...
}
c
while(scanf("%s%d",s,&n)==2) //to
see if the scanf read in as many items as you want
/*while(scanf(%s%d",s,&n)!=EOF) //this also work
*/
{
...
}Source
&&&&All Rights Reserved
Ying Fuchen,Xu Pengcheng,Xie DiAny problem, Please迷惑:为啥C能过,GCC就是
#include&stdio.h&
int cmp(const void *a, const void *b)
return *(int*)a - *(int*)b;
int elevation[900];
void print(int regionNum, double water_l, double percent)
printf(&Region %d\nWater level is %.2lf meters.\n%.2lf percent of the region is under water.\n\n&, regionNum, water_l, percent);
int main()
int m,n,i;
int region_ //区域的个数
//方块的个数
//水的体积
double temp_ //实时计算出的水体积
double sum_ //已经计算出来的水体积
double water_ //水面相对最低方块海拔的高度
region_num=0;
scanf(&%d %d&, &m, &n);
while(m!=0 && n!=0)
region_num++; //区域个数加1
sq_num = m*n; //计算方块的个数
//输入方块的海拔数据
for(i=0; i&sq_ i++) scanf(&%d&, &elevation[i]);
//输入水的体积
scanf(&%lf&, &water);
//对方块的海拔数据排序
qsort(elevation, sq_num, sizeof(int), cmp);
if(water & 0)
//计算水面的海拔
sum_water=0;
water_height=elevation[0];
for(i=1; i&sq_ i++)
temp_water = 100*i*(elevation[i]-elevation[i-1]);
if(temp_water==0)
if(sum_water + temp_water & water) //还没有达到水的总体积
sum_water += temp_
water_height = elevation[i];
else //达到或超过了水的总体积
water_height += (water-sum_water)/(100*i);
sum_water =
//输出结果
print(region_num, water_height, (double)(i*100)/(double)sq_num);
if(i==sq_num && sum_water&water)
water_height += (water-sum_water)/(100*sq_num);
print(region_num, water_height, 100);
else //water为0
print(region_num, elevation[0], 0);
scanf(&%d %d&, &m, &n);
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:42839次
排名:千里之外
原创:55篇
评论:10条
(2)(1)(2)(9)(16)(14)(1)(1)(1)(5)(3)1.4.1 POJ的提交方法
本文所属图书&>&
本书对程序设计竞赛中的基础算法和经典问题进行了汇总,分为准备篇、初级篇、中级篇与高级篇4章。作者结合自己丰富的参赛经验,对严格筛选的110 多道各类试题进行了由浅入深、由易及难的细致讲解,并介绍了许多...&&
1.4 如何提交解答这里以POJ和GCJ为例,介绍提交解答的方法。
1.4.1 POJ的提交方法
接下来,我们试着在POJ里提交写好的程序。POJ的地址是http://poj.org/。用户需要在POJ注册后才能提交。注册页面除了用户名和密码外,还有email地址等信息的输入框,这些不是非填不可的。
成功登录之后,让我们试提交一下测试题A+B Problem。
题目描述页面
A+B Problem从标准输入读入两个整数a和b,并将它们的和a+b输出到标准输出。A+B Problem里还提供了提交示例。让我们试提交下面这个程序。
#include &cstdio&
int main() {
& scanf(&%d %d&, &a, &b);
& printf(&%d\n&, a + b);
& return 0;
可以通过题目描述最下方的Submit链接提交。结果如下。
顺利获得Accepted,表示所提交解答是正确的。如果程序输入了错误的答案,则会变成Wrong Answer。试将printf(&%d\n&, a + b)替换成printf(&%d\n&, a * b)再提交,果然就返回了Wrong Answer。
Wrong Answer
和比赛一样,Online Judge对程序的运行时间是有限制的。对于A+B Problem,这个限制是1000ms。让我们试提交一个超时的程序。在printf 的后面加上一行for (;;); 后就返回了Time Limit Exceeded。
Time Limit Exceeded
的使用方法大致就是这样。此外,提交后的返回结果还有以下其他几种。
Runtime Error
表示程序因为非法内存访问或未处理异常而结束。
Memory Limit Exceeded
表示程序使用的内存超过规定的内存限制。
Presentation Error
表示虽然程序输出的答案是对的,但是换行或空格等不符合输出格式要求。
Output Limit Exceeded
表示程序输出了过多的内容。
Compile Error
表示所提交的源代码没能通过编译。这时打开Online Status的&Compile Error&链接还可以看到具体的编译错误信息。
System Error, Validator Error
表示发生错误无法正常判题。
您对本文章有什么意见或着疑问吗?请到您的关注和建议是我们前行的参考和动力&&
您的浏览器不支持嵌入式框架,或者当前配置为不显示嵌入式框架。

我要回帖

更多关于 out of limit 的文章

 

随机推荐