Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
63514 emoj [在线测评解答教程] 求和 C++ Accepted 2 MS 280 KB 281 2024-01-10 17:49:13

Tests(10/10):


Code:

#include <iostream> using namespace std; int main() { // A+B problem // int a,b; // cin>>a>>b; // cout<<a+b<<endl; // 求和 int n,sum = 0; while(cin >> n) { sum = n * (n+1) / 2; cout<<sum<<endl; } return 0; }