#18482: C++ AC


kt118 (20622易楷騰)


#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {
int a;
while(cin>>a){
cout <<(1+a)*a/2<<endl;
}
return 0;
}

#18483: Re:C++ AC


ufve0704 (爬 我爬 我爬爬爬 有排行榜這種東西就是要爬 爬過我上面的那...)


#include
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {
int a;
while(cin>>a){
cout <<(1+a)*a/2<<endl;
}
return 0;
}

你的中文....

題目說:如何不用乘法、除法、<<、>>、~、^,也不用for、while、if、else、switch、case及三元運算子,算出1+2+3+...+n ?

這裡:如何不用乘法、除法、<<、>>、~、^,也不用for、while、if、else、switch、case及三元運算子,算出1+2+3+...+n ?

還是說你沒良心?