提交时间:2023-01-11 21:52:01
运行 ID: 4323
#include<iostream> #include<vector> using namespace std; int main(){ int n; //int count = 10; vector<int> vec; while (cin >> n && n != EOF) { //cin>>n; // int sum=0; // for(int i=1;i<=n;i++){ // sum=sum+i; //} //cout<<sum; //if (n=='a') break; int sum = n*(n+1)/2; vec.push_back(sum); } for (int i=0; i<vec.size(); i++){ cout << vec[i] << endl; } return 0; }