题解 | 小乐乐求和
小乐乐求和
https://www.nowcoder.com/practice/ce0b2eacd3d04647831358c2876e44ff
#include <iostream>
using namespace std;
int main()
{
int long n,h;
scanf("%ld%ld",&n,&h);
h=(1+n)*n;
printf("%ld",h/2);
return 0;
}
小乐乐求和
https://www.nowcoder.com/practice/ce0b2eacd3d04647831358c2876e44ff
#include <iostream>
using namespace std;
int main()
{
int long n,h;
scanf("%ld%ld",&n,&h);
h=(1+n)*n;
printf("%ld",h/2);
return 0;
}
相关推荐