余元
发表于 2020-8-27 15:53:09
0. 100
1. 10
2. a
3. a = 14, b = 5, c = 9
4. x >= 0 ? z = x : z = -x;
5.A.
if (size > 12)
{
cost = cost * 1.05;
flag = 2;
}
bill = cost * flag;
B.
if (ibex > 14)
{
sheds = 3;
}
sheds = 2;
help = 2 * sheds;
C.
if (score < 0)
{
stage2: printf("count = %d\n", count);
}
count++;
scanf("%d", &score);
0.#include<stdio.h>
int main()
{
int year;
float jiayu = 10000, heiye = 10000;
while(jiayu >= heiye)
{
jiayu += 10000 * 0.1;
heiye += heiye * 0.05;
year++;
}
printf("%d年后,黑夜的投资额超过小甲鱼!\n", year);
printf("小甲鱼的投资额是:%.2f\n", jiayu);
printf("黑夜的投资额是:%.2f\n", heiye);
return 0;
}
1.#include<stdio.h>
int main()
{
int year, moeny = 400;
while(moeny > 0)
{
moeny -= 50;
moeny += moeny * 0.08;
year++;
}
printf("%d年后,小甲鱼败光了所有家产,再次回到一贫如洗......", year);
return 0;
}
2.
oooooook
发表于 2020-8-27 16:48:24
{:10_257:}
cccccd
发表于 2020-8-27 20:45:04
{:5_90:}
之朝百
发表于 2020-8-27 21:44:13
0.10次
1.0次
2.a、b、c
3.a = 14, b = 5, c = 9
4.z = x>0?x:-x;
5.A:
if (size > 12)
{
cost = cost * 1.05;
flag = 2;
}
bill = cost * flag;
B:
if (ibex > 14)
{
sheds = 3;
}
sheds = 2;
help = 2 * sheds;
C:
while(scanf("%d", &score) == 1)
if (score < 0)
{
printf("count = %d\n", count);
}
count++;
continue;
动动手:
0.
#include <stdio.h>
int main()
{
float jiayu = 10000, heiye = 10000;
int counter = 0;
do{
counter++;
jiayu += 10000*0.1;
heiye *= 1.05;
}while(heiye<jiayu);
printf("%d年之后,黑夜的钱超过小甲鱼!\n", counter);
printf("小甲鱼的投资额是:%.2f\n", jiayu);
printf("黑夜的投资额是:%.2f\n", heiye);
return 0;}
1.
#include <stdio.h>
#define fr_blion 4000000
#define _50w 500000
int main()
{
int i = 1, _400w = fr_blion;
for(_400w -= _50w; _400w > 0; _400w -= _50w, ++i){
_400w *= 1.08;
}
printf("%d年之后,小甲鱼败光所有家产,再次回到一贫如洗", i);
return 0;
}
2.
#include <stdio.h>
int main()
{
int j;
float i,pi = 1, k;
for( i = 3, j = 2; (1/i)> 10e-8;++j, i = i +2 ){
if(j % 2 == 0)
k = -1/i;
else k = 1/i;
pi += k;
}printf("pi = %.7f", 4*pi);
return 0;}
3.
#include <stdio.h>
int main(void){
printf("不会");
return 0;}
泊车小弟
发表于 2020-8-27 22:39:49
6
-------lii
发表于 2020-8-28 09:45:28
{:10_323:}
努力的小沈
发表于 2020-8-28 10:34:02
修改
清染今天在摸鱼
发表于 2020-8-28 12:06:47
K
zxcbcv
发表于 2020-8-28 14:41:35
1
今晚打地鼠
发表于 2020-8-29 15:34:51
学习了
yongming0321
发表于 2020-8-29 17:51:14
ccccccccccccccccccccccccccccccccccccccc
xross
发表于 2020-8-30 11:53:31
对答案
shengtiancai
发表于 2020-8-30 12:09:45
1
q208546247
发表于 2020-8-30 16:22:20
那个利率不应该是怎么表达的吗?为什么我是两年
int year=0;
float hy = 10000;
...
year++;
xjy = 10000 + (year*10000*0.);
hy = hy + (hy*0.05);
if ....
qw098911
发表于 2020-8-30 16:30:07
855555555
'三天打鱼'
发表于 2020-8-31 01:26:10
10,10,4,9,16
x710583435
发表于 2020-8-31 21:02:43
测试:
0.很多个A,无法满足判断条件。
1.10次,进入while语句的时候先执行i++,这样的话if就判断了11次,打印了10个B
2.a,b,c;a,b,c均为变量,得到右边5的赋值。
3.a=14,b=4,c=10
4.x >= 0 ? z = x, z = -x;
5.
A.
if (size > 12)
{
cost = cost * 1.05;
flag = 2;
continue;
}
bill = cost * flag;
B.
if (ibex > 14)
{
sheds = 3;
continue;
}
sheds = 2;
help = 2 * sheds;
C.
while(1)
{
scanf("%d", &score);
if (score < 0)
{
printf("count = %d\n", count);
break;
}
count++;
}
动动手:
0.
#include <stdio.h>
#include <math.h>
#define MONEY_FISH 10000 //定义小甲鱼和黑夜初始资金
#define MONEY_BLACK_NIGHT 10000
#define M_F_I 0.1//分别定义二者的单利息与复合利息
#define M_B_N_I 0.05
int main()
{
float M_F,M_B_N;//定义小甲鱼和黑夜的投资额所代表的自变量
int year;//黑夜投资额超过小甲鱼所需要的年限
for(year = 0,M_B_N = MONEY_BLACK_NIGHT,M_F = MONEY_FISH;M_B_N <= M_F;year++)
{
M_B_N *= (1+M_B_N_I) ;
M_F += MONEY_FISH * M_F_I;
}
printf("%d年后,黑夜的投资额超过小甲鱼!\n",year);
printf("小甲鱼的投资额是:%.2f\n",M_F);
printf("黑夜的投资额是:%.2f\n",M_B_N);
return 0;
}
1.
#include <stdio.h>
#define F_M 4000000 //定义小甲鱼的初始资金
#define F_COST 500000//小甲鱼一年开销
#define interst 0.08//红利
int main()
{
int year;
float F_M_T;//小甲鱼的实时资金
for(year = 0,F_M_T = F_M;F_M_T >= 0;year++)
{
F_M_T -= F_COST;
F_M_T *= (1+interst);
}
printf("%d年之后,小甲鱼败光了所有的家产,再次回到一贫如洗......\n",year);
return 0;
}
2.
#include <stdio.h> //计算π的小数点后前7位
#include <math.h>
int main()
{
double i,j,k;//分母,循环跳出条件,分数
double result,temp;//结果与临时结果
_Bool flag = 1;//为1是分数为正,为0是分数为负
j = pow(10,-8);
for(temp = 0,i = 1;(1 / i) >= j;i+=2)
{
if(flag)
{
k = 1 / i;
flag = 0;
}
else
{
k = -(1 / i);
flag = 1;
}
temp += k;
}
result = 4 *temp;
printf("结果是:%.7f",result);
return 0;
}
3.
#include <stdio.h>
#define AIM_Y 2//目标年限
int main()
{
int total_M,i;//总月份,计数器(月)
int C_B,C_1_B,C_2_B;//分别表示能繁殖,差一个月能繁殖,差两个月繁殖繁殖
int temp1 = 0;//差一月能繁殖兔子数量临时存储
int temp2 = 0;//差两月能繁殖兔子数量临时存储
total_M = AIM_Y * 12;
//total_M = 4;//测试基础月份繁殖数量是否正确
C_B = 1;
C_1_B = C_2_B = 0;//最初三种繁殖状态的兔子初始数量(对)
/*每一个月过去就会诞生一批和能繁殖数量一样的差两个月能繁殖的兔子
就会有差一个月能繁殖数量的兔子变为能繁殖
差两个月能繁殖的兔子变为差一个月能繁殖
能繁殖的兔子总是在变多,而差一、两个月能繁殖的兔子会动态变化,由于每个月繁殖会导致差两个月能繁殖的兔子全部成为差一个月繁殖
故差两个月能繁殖的兔子总是等于当月能繁殖的兔子的数量,差一个月能繁殖的兔子数量同理
*/
for(i = 1;i<= total_M ;i++)
{
temp2 = C_2_B;/*先取得差两个月能繁殖的兔子数量存储起来,否则被能繁殖的兔子数量覆盖以后,
就无法得出差一个月能繁殖兔子数量的值,因为差一个月能繁殖的兔子数量与差两个月能繁殖的数量上是相等的,下面同理*/
C_2_B = C_B;
temp1 = C_1_B;
C_1_B = temp2;
C_B = C_B +temp1;
}
printf("经过了%d年,繁殖了%d对兔子\n",AIM_Y,C_B+C_1_B+C_2_B);
return 0;
}
就是要参加acm!
发表于 2020-8-31 21:34:30
90
9
Ostudent
发表于 2020-9-1 00:18:35
对答案
lanch
发表于 2020-9-1 13:08:58
1