結果

問題 No.276 連続する整数の和(1)
ユーザー spaciaspacia
提出日時 2016-01-04 14:44:18
言語 Java17
(openjdk 17.0.1)
結果
AC  
実行時間 52 ms / 1,000 ms
コード長 455 bytes
コンパイル時間 1,899 ms
使用メモリ 34,012 KB
最終ジャッジ日時 2022-11-18 00:48:59
合計ジャッジ時間 3,180 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 52 ms
34,000 KB
testcase_01 AC 51 ms
33,744 KB
testcase_02 AC 50 ms
33,840 KB
testcase_03 AC 51 ms
33,976 KB
testcase_04 AC 51 ms
33,836 KB
testcase_05 AC 51 ms
33,760 KB
testcase_06 AC 51 ms
34,012 KB
testcase_07 AC 50 ms
33,920 KB
testcase_08 AC 50 ms
33,772 KB
testcase_09 AC 51 ms
34,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.math.*;

class Main {
	
	public static void out (Object o) {
		System.out.println(o);
	}
	
	public static long gcd (long m , long n) {
		return n == 0 ? m : gcd(n , m % n);
	}
	
	public static void main (String[] args) throws IOException {
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		long n = Long.parseLong(br.readLine());
		
		out(gcd(n * (n - 1) / 2 , n));
	}
}
0