1 #include <iostream> 2 using namespace std; 3 int main() 4 { 5 int n ; 6 while(cin>>n) { 7 cout << n*(n+1)/2 << endl << endl ; 8 } 9 return 0; 10 }
时间: 2024-10-17 01:24:55
1 #include <iostream> 2 using namespace std; 3 int main() 4 { 5 int n ; 6 while(cin>>n) { 7 cout << n*(n+1)/2 << endl << endl ; 8 } 9 return 0; 10 }