結果
| 問題 |
No.276 連続する整数の和(1)
|
| コンテスト | |
| ユーザー |
newlife171128
|
| 提出日時 | 2018-01-28 19:39:41 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
RE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 603 bytes |
| コンパイル時間 | 1,435 ms |
| コンパイル使用メモリ | 159,180 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-29 14:47:31 |
| 合計ジャッジ時間 | 3,717 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | RE * 10 |
コンパイルメッセージ
main.cpp: In function ‘ll gcd(ll, ll)’:
main.cpp:27:12: warning: control reaches end of non-void function [-Wreturn-type]
27 | gcd(b, a%b);
| ~~~^~~~~~~~
ソースコード
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cmath>
#include <stack>
#include <queue>
#include <cctype>
#include <stdio.h>
#include <map>
#include <string.h>
#include <utility>
typedef long long ll;
using namespace std;
typedef pair<int, int> P;
ll gcd(ll a, ll b){
if(b==0){
return a;
}
gcd(b, a%b);
}
int main() {
ll n=0;
cin>>n;
ll a = (n+1)*(n/2);
if(n%2 ==1){
a += (n+1)/2;
}
ll b = a-1+n+1;
/*
cout<<a<<endl;
cout<<b<<endl;
*/
cout<<gcd(b,a)<<endl;
return 0;
}
newlife171128