Skip to content

nshun/coding-practice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Coding Practice

コーディング訓練用リポジトリ

主に AtCoder の過去問を解いている

新規

setup.sh を使うことで、テンプレートファイルのコピーとシンボリックリンクを貼ってくれる

./setup.sh CONTEST_NAME

デバッグ

リポジトリルートの debug.cpp がデバッグ対象

シンボリックリンクを貼ることを想定

ln -s SOURCE debug.cpp

環境

  • MinGW
    • gcc
    • gdb
    • ln
  • VSCode 拡張
    • C/C++

Tips

iostream 周り

  • 同期を無効化
cin.tie(0);
ios::sync_with_stdio(false);
  • endl -> \n

  • 桁数指定

cout << fixed << setprecision(9) << S << '\n';

最小公倍数・最大公約数

// 最大公約数
ll gcd(ll a, ll b)
{
  return b == 0 ? a : gcd(b, a % b);
}

// 最小公倍数
ll lcm(ll a, ll b)
{
  return a / gcd(a, b) * b;
}

全列挙

2^N 通りの列挙を行いたい場合

REP(bit, 1 << N)
{
  bool on[N];
  REP(i, N)
  {
    on[i] = bit & (1 << i);
  }
  if (check(on))
    result++;
}

Reference

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published