結果

問題 No.480 合計
ユーザー lifefucker_1911
提出日時 2017-10-02 22:46:59
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 356 bytes
コンパイル時間 741 ms
コンパイル使用メモリ 66,576 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-14 09:44:49
合計ジャッジ時間 1,551 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <stack>
#include <queue>
#include <vector>
#include <time.h>
using namespace std;

int sum1toN(int n){
	if( n == 1){
		return 1;
	}
	return n + sum1toN( n -1);
}
int main(){
	int n;
	cin>>n;
	cout<< sum1toN(n) <<endl;
	return 0;
}
0