結果

問題 No.1822 Keima of Shogi
ユーザー soragsorag
提出日時 2022-08-22 22:17:28
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,170 bytes
コンパイル時間 1,098 ms
コンパイル使用メモリ 115,608 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-18 13:31:25
合計ジャッジ時間 1,685 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 1 ms
6,944 KB
testcase_09 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include<utility>
#include <vector>
#include <map>
#include<string>
#include<queue>
#include<math.h>
#define pb push_back
#define all(x) begin(x),end(x)
#define gall(x) begin(x),end(x),greater<>()
#define ll long long
#define P pair<int,int>
#define lP pair<ll,ll>
#include <iostream>
#include <vector>
using namespace std;
vector<pair<long long, long long> > prime_factorize(long long N) {
vector<pair<long long, long long> > res;
for (long long p = 2; p * p <= N; ++p) {
        if (N % p != 0) {
            continue;
        }
        int e = 0;
        while (N % p == 0) {
            ++e;
            N /= p;
        }
        res.emplace_back(p, e);
    }
    if (N != 1) {
        res.emplace_back(N, 1);
    }
    return res;
}
struct UnionFind{
    vector<int> p;
    UnionFind(int n){
        p.resize(n,-1);
    }
    int find(int x){
        if(p[x]== -1) return x;
        else return find(p[x]);
    }
    void unite(int x,int y){
        x=find(x);
        y=find(y);
        if(x==y) return;
        p[x]=y;
    }
};

int main() {
    ll n;
    cin>>n;
    ll m=(n+1)/2;
    ll ans=m*(m+1)/2;
    cout<<ans<<endl;
    return 0;
}

0