結果
| 問題 |
No.276 連続する整数の和(1)
|
| コンテスト | |
| ユーザー |
gu_21816943
|
| 提出日時 | 2017-06-27 01:51:39 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 966 ms / 1,000 ms |
| コード長 | 542 bytes |
| コンパイル時間 | 2,398 ms |
| コンパイル使用メモリ | 74,300 KB |
| 実行使用メモリ | 51,000 KB |
| 最終ジャッジ日時 | 2024-10-04 10:01:06 |
| 合計ジャッジ時間 | 5,868 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int num=Integer.parseInt(br.readLine());
br.close();
long sum1=0,sum2=0;
int i;
for(i=1;i<=num;i++){
sum1+=i;
sum2+=i+1;
}
System.out.println(euclid(sum2,sum1));
}
public static long euclid(long a,long b){
if(b==0){
return a;
}else{
return euclid(b,a%b);
}
}
}
gu_21816943