結果

問題 No.1052 電子機器X
ユーザー umezo
提出日時 2020-05-15 22:02:34
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 651 bytes
コンパイル時間 2,555 ms
コンパイル使用メモリ 222,852 KB
最終ジャッジ日時 2025-01-10 11:39:05
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other WA * 1 TLE * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

#include <bits/stdc++.h>
using namespace std;


int main(){
  ll n,k;
  cin>>n>>k;
  
  set<ll> s;
  if(k%2==0){
    for(ll i=0;i<=k;i+=2) s.insert(i%n);
    for(ll i=0;i<=k;i+=2) s.insert(n-(i%n));
  }
  else{
    for(ll i=1;i<=k;i+=2) s.insert(i%n);
    for(ll i=1;i<=k;i+=2) s.insert(n-(i%n));
  }
  cout<<s.size()<<endl;
  
  return 0;
}
0