結果
| 問題 |
No.831 都市めぐり
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-08-29 18:17:35 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 791 bytes |
| コンパイル時間 | 1,771 ms |
| コンパイル使用メモリ | 153,168 KB |
| 最終ジャッジ日時 | 2024-11-14 20:35:57 |
| 合計ジャッジ時間 | 2,419 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp:10:27: error: ‘lcm’ function uses ‘auto’ type specifier without trailing return type
10 | #define def inline auto
| ^~~~
main.cpp:16:1: note: in expansion of macro ‘def’
16 | def lcm(ll a,ll b) {return a*b/gcd(a,b);}
| ^~~
main.cpp:10:27: note: deduced return type only available with ‘-std=c++14’ or ‘-std=gnu++14’
10 | #define def inline auto
| ^~~~
main.cpp:16:1: note: in expansion of macro ‘def’
16 | def lcm(ll a,ll b) {return a*b/gcd(a,b);}
| ^~~
main.cpp:10:27: error: ‘dig’ function uses ‘auto’ type specifier without trailing return type
10 | #define def inline auto
| ^~~~
main.cpp:17:1: note: in expansion of macro ‘def’
17 | def dig(ll a) {return to_string(a).length();}
| ^~~
main.cpp:10:27: note: deduced return type only available with ‘-std=c++14’ or ‘-std=gnu++14’
10 | #define def inline auto
| ^~~~
main.cpp:17:1: note: in expansion of macro ‘def’
17 | def dig(ll a) {return to_string(a).length();}
| ^~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using prefix = __attribute__((constructor))void;
const ll MOD = 1000000007;
const ll INF = 9223372036854775807LL;
#define elif else if
#define def inline auto
#define func inline ll
#define lp(i,a,n) for(ll i=(a),i##_1=(n);i<i##_1;++i)
#define rep(i,n) lp(i,0,n)
func gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
def lcm(ll a,ll b) {return a*b/gcd(a,b);}
def dig(ll a) {return to_string(a).length();}
prefix init() {cin.tie(0),ios::sync_with_stdio(0);}
signed main(){
ll N,s=0;
cin>>N;
if(N==1){
cout<<"0\n";
return 0;
}
rep(i,N-1){
if(i&1){
s+=(N-i)*(i+2);
}
else{
s+=(i+1)*(N-(i+1));
}
}
if(!(N&1))s+=N/2;
cout<<s+N<<"\n";
}