結果
問題 | No.821 Making Integers |
ユーザー |
![]() |
提出日時 | 2019-04-26 21:28:11 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 848 bytes |
コンパイル時間 | 1,517 ms |
コンパイル使用メモリ | 166,524 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-25 02:02:30 |
合計ジャッジ時間 | 1,845 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 9 |
ソースコード
#include <bits/stdc++.h>using namespace std;typedef long long ll;typedef long double dd;//#define i_7 (ll)(1E9+7)#define i_7 998244353#define i_5 i_7-2ll mod(ll a){ll c=a%i_7;if(c>=0)return c;return c+i_7;}typedef pair<ll,ll> l_l;ll inf=(ll)1E17;#define rep(i,l,r) for(ll i=l;i<=r;i++)#define pb push_backll max(ll a,ll b){if(a<b)return b;else return a;}ll min(ll a,ll b){if(a>b)return b;else return a;}void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);void Min(ll &pos,ll val){pos=min(pos,val);}void Add(ll &pos,ll val){pos=mod(pos+val);}dd EPS=1E-9;#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);///////////////////////////////////////int main(){fastioll n,k;cin>>n>>k;ll ans=n*(n+1)/2-(n-k)*(n-k+1)/2;cout<<ans+1<<endl;return 0;}