intさわだんのBlack History

刹那的レジェンドになりたい。

算数的

第6回日本情報オリンピック 春合宿 1日目 問題2 「階乗」 (Factorial)

このブログを参考にしました。[JOI合宿]2007-Day1:Factorial:Snowing day:So-net blog [JOI合宿]2007-Day1:Factorial:Snowing day:So-net blog #include <bits/stdc++.h> using namespace std; int ans; int main(){ int n; scanf("%d",&n); for(int i = 2;i <=n;i+=2){</bits/stdc++.h>…

AOJ 0009 Prime Number

エラトステネスの篩、生半可な知識で適当に実装してみたら一発で通ったのでらっきー。bool型の配列って全部初期化すること可能なんでしょうか。 #include <cstdio> #include <iostream> using namespace std; int main(){ int n; while(cin >> n){ bool d[1000000]; int ans = </iostream></cstdio>…

Codeforces #1A

問題文算数の問題。 解法は顕著。なんかショートコーダーみたいになった。 #include <iostream> #include <algorithm> using namespace std; int main(){ long long int n,m,a,t=1; cin >> n >> m >> a; cout << max(t,(n % a == 0 ? n / a : n / a + 1))*max(t,(m % a == 0 ? m /</algorithm></iostream>…