当前位置:网站首页>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;
}边栏推荐
猜你喜欢

Niuke: crossing the river

Analysis of gene family characteristics - chromosome location analysis

556. 下一个更大元素 III

Adc128s022 ADC Verilog design and Implementation

Mysql多表查询 #子查询

Tonybot humanoid robot checks the port and corresponds to port 0701

Pyqt interface production (login + jump page)

使用并行可微模拟加速策略学习

Polestar美股上市:5.5万台交付如何支持得起超200亿美元估值

Eight sorts
随机推荐
tonybot 人形机器人 定距移动 代码编写玩法
Programming language: the essence of type system
必贝特医药冲刺科创板:年营收97万亏损1.37亿 拟募资20亿
7-9 one way in, two ways out (25 points)
动态获取权限
Timecho of Tianmou technology completed an angel round financing of nearly 100 million yuan to create a native timing database of the industrial Internet of things
Sendmail can't send mail and it's too slow to send. Solve it
556. The next larger element III
使用并行可微模拟加速策略学习
Stop asking yourself if you are suitable for software testing
556. 下一个更大元素 III
[qingniaochangping campus of Peking University] in the Internet industry, which positions are more popular as they get older?
洛谷P5536 【XR-3】核心城市 题解
7-17 crawling worms (break exercise)
7-28 monkeys choose King (Joseph problem)
Bibit pharmaceutical rushed to the scientific innovation board: annual revenue of 970000, loss of 137million, proposed to raise 2billion
全文检索引擎Solr系列—–全文检索基本原理
Common commands for getting started with mongodb database
Tailing rushes to the scientific and Technological Innovation Board: it plans to raise 1.3 billion, and Xiaomi Changjiang is the shareholder
Table of mathematical constants by q779