当前位置:网站首页>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;
}边栏推荐
- 如何查询淘宝天猫的宝贝类目
- Statistical capital consonants
- Programming language: the essence of type system
- 【7.3】146. LRU caching mechanism
- Raft agreement
- 数学常数表 by q779
- Leetcode (4) - - trouver la médiane de deux tableaux ordonnés positifs
- 7-23 currency conversion (using array conversion)
- fpga阻塞赋值和非阻塞赋值
- Puzzle (016.4) domino effect
猜你喜欢

Use of constraintlayout

愉悦资本新双币基金近40亿元完成首次关账

Concat and concat_ Ws() differences and groups_ Use of concat() and repeat() functions

retrofit

Programming language: the essence of type system

Accelerating strategy learning using parallel differentiable simulation

Puzzle (016.3) is inextricably linked

Tiantu investment sprint Hong Kong stocks: asset management scale of 24.9 billion, invested in xiaohongshu and Naixue

Detailed explanation of four modes of distributed transaction (Seata)

Understanding of closures
随机推荐
Convert string to decimal integer
Tiantu investment sprint Hong Kong stocks: asset management scale of 24.9 billion, invested in xiaohongshu and Naixue
7-20 print 99 formula table (format output)
7-14 sum integer segments (C language)
7-16 find the set of integers that meet the given conditions
7-3 rental (20 points)
Protobuf and grpc
Jiuyi cloud black free encryption free version source code
Strategy, tactics (and OKR)
tonybot 人形機器人 紅外遙控玩法 0630
MongoDB索引
Tailing rushes to the scientific and Technological Innovation Board: it plans to raise 1.3 billion, and Xiaomi Changjiang is the shareholder
Puzzle (016.3) is inextricably linked
Solr series of full-text search engines - basic principles of full-text search
论文分享:Generating Playful Palettes from Images
Detailed explanation of four modes of distributed transaction (Seata)
Luogu p3065 [usaco12dec]first! G problem solution
tonybot 人形机器人 首次开机 0630
Get permissions dynamically
全文检索引擎Solr系列—–全文检索基本原理