早教吧作业答案频道 -->英语-->
hduacm第1592题哪里错了?代码如下,错误是runtimeerrorProblemDescriptionGardonboughtmanymanychocolatesfromtheAChocolateMarket(ACM).WhenhewasonthewaytomeetAngel,hemetSpeaklessbyaccident."Ah,somanydeliciouschocola
题目详情
hdu acm 第1592题哪里错了?代码如下,错误是 runtime error
Problem Description
Gardon bought many many chocolates from the A Chocolate Market (ACM).When he was on the way to meet Angel,he met Speakless by accident.
"Ah,so many delicious chocolates!I'll get half of them and a half!" Speakless said.
Gardon went on his way,but soon he met YZG1984 by accident.
"Ah,so many delicious chocolates!I'll get half of them and a half!" YZG1984 said.
Gardon went on his way,but soon he met Doramon by accident.
"Ah,so many delicious chocolates!I'll get half of them and a half!" Doramon said.
Gardon went on his way,but soon he met JGShining by accident.
"Ah,so many delicious chocolates!I'll get half of them and a half!" JGShining said.
.
.
.
After had had met N people ,Gardon finally met Angel.He gave her half of the rest and a half,then Gardon have none for himself.Could you tell how many chocolates did he bought from ACM?
Input
Input contains many test cases.
Each case have a integer N,represents the number of people Gardon met except Angel.N will never exceed 1000;
Output
For every N inputed,tell how many chocolates Gardon had at first.
Sample Input
2
Sample Output
7
题目分析可知是2的(n+1)次方减去1;
#include
int f[1001][1001];
void add(int k)
{
int i;
for(i=0;i
Problem Description
Gardon bought many many chocolates from the A Chocolate Market (ACM).When he was on the way to meet Angel,he met Speakless by accident.
"Ah,so many delicious chocolates!I'll get half of them and a half!" Speakless said.
Gardon went on his way,but soon he met YZG1984 by accident.
"Ah,so many delicious chocolates!I'll get half of them and a half!" YZG1984 said.
Gardon went on his way,but soon he met Doramon by accident.
"Ah,so many delicious chocolates!I'll get half of them and a half!" Doramon said.
Gardon went on his way,but soon he met JGShining by accident.
"Ah,so many delicious chocolates!I'll get half of them and a half!" JGShining said.
.
.
.
After had had met N people ,Gardon finally met Angel.He gave her half of the rest and a half,then Gardon have none for himself.Could you tell how many chocolates did he bought from ACM?
Input
Input contains many test cases.
Each case have a integer N,represents the number of people Gardon met except Angel.N will never exceed 1000;
Output
For every N inputed,tell how many chocolates Gardon had at first.
Sample Input
2
Sample Output
7
题目分析可知是2的(n+1)次方减去1;
#include
int f[1001][1001];
void add(int k)
{
int i;
for(i=0;i
▼优质解答
答案和解析
额,如果已经知道答案是2的(n+1)次方减一了的话,你为什么不直接include然后调用pow(2.0,n+1)函数,得出结果再减一不就行了?
看了 hduacm第1592题哪里...的网友还看了以下:
有关系模式R(S,T,C,D,G),根据语义有如下函数依赖集:F={(S,C) →T,C →D,(S 2020-05-23 …
第(54)~(55)题基于以下描述:有关系模式R(S,T,C,D,G),根据语义有如下函数依赖集:F 2020-05-23 …
基于以下描述:有关系模式R(S,T,C,D,G),根据语义有如下函数依赖集:F={(S,C)→T,C 2020-05-23 …
基于以下描述:有关系模式R(S, T, C, D, G),根据语义有如下函数依赖集:F={(S, C 2020-05-24 …
计算一条链为3‘A-T-A-G-C-T-G-C-A-G-T-G-A5’的双链片段的碱基组成?写出具 2020-06-07 …
现有一待测核酸样品,经检测后,对碱基个数统计和计算得到下列结果(A+T):(G+C)=(A+G): 2020-07-26 …
碱基计算的规律.①A等于T,G等于C,A+G=T+CA+G/T+C等1.②一条单链的A+G/T+C的 2020-11-27 …
.某双链DNA分子中,作为模板链的部分碱基的排列顺序是:G—C—A—G—T—A—C—C—G—C—G— 2020-11-29 …
以DNA的一条链“…—A—T—C—…”为模板,经复制后的子链是[]A.…T—A—G—…B.…—U—A 2020-12-18 …
遗传物质控制蛋白质合成的时候,氨基酸对应的密码子是DNA上的同步还是mRNA?DNA链碱基序列G-C 2020-12-21 …