結果

問題 No.1519 Diversity
ユーザー asaringoasaringo
提出日時 2021-08-19 22:43:12
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 91 ms / 2,000 ms
コード長 556 bytes
コンパイル時間 1,613 ms
コンパイル使用メモリ 163,776 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-21 02:08:24
合計ジャッジ時間 3,627 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,816 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 32 ms
6,944 KB
testcase_04 AC 66 ms
6,944 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 88 ms
6,940 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 13 ms
6,940 KB
testcase_09 AC 34 ms
6,944 KB
testcase_10 AC 63 ms
6,940 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 84 ms
6,940 KB
testcase_13 AC 87 ms
6,944 KB
testcase_14 AC 91 ms
6,944 KB
testcase_15 AC 87 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std ;
typedef long long ll ;
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define rrep(i,a,b) for(int i = a ; i < b ; i++)

const int mod = 1000000007 ;

int n ;

int main(){
    cin >> n ;
    int sum = 0 ;
    for(int i = n - 1 ; i > 0 ; i -= 2) sum += i ;
    cout << sum << endl ;
    int tmp = 1 , beg = 2 , end = n ;
    while(end >= beg){
        while(beg <= end){
            cout << tmp << " " << beg << endl ;
            beg++ ;
        }
        tmp++ ;
        beg = tmp + 1 ;
        end-- ;
    }
}
0