当前位置:网站首页>Zzuli:1049 square sum and cubic sum
Zzuli:1049 square sum and cubic sum
2022-07-03 14:34:00 【Snake_____】
Title Description
Given two integers m and n, Find out m~n The sum of squares of all even numbers and the sum of cubes of all odd numbers in this continuous integer .
Input
By two integers m and n form , You can assume that m<=n.
Output
Should include two integers x and y, Represent the sum of squares of all even numbers and the sum of cubes of all odd numbers in the continuous integer .32 Bit integers are enough to hold the results .
The sample input Copy
2 5
Sample output Copy
20 152
#include <stdio.h>
int main()
{
int m,n,i,mul=1,x=0,y=0;
scanf("%d%d",&m,&n);
for(i=m;i<=n;i++)
{
if(i%2==0)
{
mul=i*i;
x=x+mul;
}
else
{
mul=i*i*i;
y=y+mul;
}
}
printf("%d %d",x,y);
return 0;
}
边栏推荐
- Special research report on the market of lithium battery electrolyte industry in China (2022 Edition)
- Find specified characters
- 556. The next larger element III
- Mongodb index
- tonybot 人形機器人 紅外遙控玩法 0630
- JVM garbage collector
- Mysql多表查询 #子查询
- How to query the baby category of tmall on Taobao
- Raft agreement
- Etcd cluster permission management and account password usage
猜你喜欢
Doris学习笔记之数据表的创建
Use of constraintlayout
adc128s022 ADC verilog设计实现
Puzzle (016.3) is inextricably linked
Similarities and differences between Allegro, OrCAD, net alias, port, off page connector and how to select them
剑指 Offer 28. 对称的二叉树
tonybot 人形機器人 紅外遙控玩法 0630
NPM install is stuck with various strange errors of node NPY
表单文本框的使用(一) 选择文本
tonybot 人形机器人 首次开机 0630
随机推荐
Detailed explanation of four modes of distributed transaction (Seata)
愉悦资本新双币基金近40亿元完成首次关账
7-16 find the set of integers that meet the given conditions
7-3 rental (20 points)
7-22 tortoise and rabbit race (result oriented)
retrofit
Niuke: crossing the river
ShowMeBug入驻腾讯会议,开启专业级技术面试时代
7-10 stack of hats (25 points) (C language solution)
7-19 check denomination (solve binary linear equation)
Concat and concat_ Ws() differences and groups_ Use of concat() and repeat() functions
论文分享:Generating Playful Palettes from Images
一文了解微分段应用场景与实现机制
How Facebook moves instagram from AWS to its own server
Special research report on the market of lithium battery electrolyte industry in China (2022 Edition)
Understanding of closures
7-20 print 99 formula table (format output)
洛谷P4047 [JSOI2010]部落划分 题解
LNMP环境mail函数不能发送邮件解决
Jiuyi cloud black free encryption free version source code