tozangezan's diary

勝手にソースコードをコピペして利用しないでください。

Codeforces

今日解いた問題たち⑩

ICPCからの現実逃避のためにCodeforcesのcombinatoricsをまたやってみました。前回からしばらく空いていたので、そのあいだに埋めていないsolvedの多い問題も増えていました。353B: Two Heaps Greedyつらい。 #include<stdio.h> #include<algorithm> using namespace std; int b[</algorithm></stdio.h>…

Codeforces Round #202 (Div. 1)

最近CFがやたらと好調。A: 二分探索した。どうとでもなるらしい。 #include<stdio.h> #include<algorithm> using namespace std; int b[100100]; int main(){ int a; scanf("%d",&a); for(int i=0;i</algorithm></stdio.h>

Codeforces Round #201 (Div. 1)

不思議。A:GCD求めてほげるだけ。落ちた。 #include<stdio.h> #include<algorithm> using namespace std; int b[100]; int gcd(int a,int b){ while(b){ a%=b; int c=a; a=b; b=c; }return a; } int main(){ int a; scanf("%d",&a); for(int i=0;i</algorithm></stdio.h>

今日解いた問題たち⑨

今日は実装が楽系多め。9D - How many trees? dp[i][j]:=i個のノードを持つ高さj以上の二分木の個数 #include<stdio.h> #include<algorithm> using namespace std; long long dp[100][100]; long long calc(int a,int b){ if(~dp[a][b])return dp[a][b]; if(a</algorithm></stdio.h>

今日解いた問題たち⑧

解法を考えて整理してからPCを起動するとはかどる。213B - Numbers 桁ごとに挿入するタイプの数え上げDP。leading 0を取り除くために最上位をループで決めています。 #include<stdio.h> #include<algorithm> using namespace std; int d[10]; long long dp[10][101]; int C[1000]</algorithm></stdio.h>…

今日解いた問題たち⑦

だんだん難しい問題に当たるようになってきて大変。156C - Cipher よく考えたら文字関係無いじゃん… #include<stdio.h> #include<algorithm> #include<string.h> using namespace std; int dp[101][2600]; char str[128]; int main(){ int a; int mod=1000000007; dp[0][0]=1; for(int i=0;i</string.h></algorithm></stdio.h>…

今日解いた問題たち⑥

これ、⑳までいったらどうしようと思ったんですが、Unicodeには㊿まであるっぽいので、ひとまず安泰です。128C - Games with Rectangle (a-1)C(c*2)+(b-1)C(c*2)。成立しないケースが邪魔。配列外で死。 #include<stdio.h> #include<algorithm> using namespace std; long long C[</algorithm></stdio.h>…

今日解いた問題たち⑤

今日はCodeforcesの問題を解くのをお休みにして、Readforcesの問題を解くことにしました。229C - Triangles 問題文を読み間違えていた。正しく読めば簡単。 Knの三角形はnC3個。 ここからm辺取り除くとまずm*(n-2)個の三角形が消え、包除原理で頂点を共有す…

今日解いた問題たち④

今日は軽めです。107B - Basketball Team 確率の計算を普通にやる。 #include<stdio.h> #include<algorithm> using namespace std; int d[1000]; int main(){ int a,b,c; scanf("%d%d%d",&a,&b,&c); for(int i=0;i</algorithm></stdio.h>

今日解いた問題たち③

今日もcombinatorics埋めていきます。319A - Malek Dance Club 難しそうだが考えたら独立だった。 #include<stdio.h> #include<algorithm> #include<string.h> using namespace std; char str[128]; int main(){ scanf("%s",str); int mod=1000000007; int n=strlen(str); int ret=0; for(i</string.h></algorithm></stdio.h>…

今日解いた問題たち②

つづきです。Solvedがだんだん減っていきます。84B - Magical Array 数えるだけ。オーバーフローした。 #include<stdio.h> int a[100000]; int main(){ int b; scanf("%d",&b); for(int i=0;i</stdio.h>

今日解いた問題たち①

今日は簡単な順にcombinatoricsを埋めています。Solvedの多い問題からCombinatoricsを埋めていきます。131C - The World is a Theatre コンビネーションの掛け算やるだけ。 #include<stdio.h> long long C[61][61]; int main(){ int a,b,c; scanf("%d%d%d",&a,&b,&c);</stdio.h>…

CFの過去問を埋めます!!(決意)

せっかくの機会なので、CFの過去問をガチで埋めていこうと思います。しばらく経つ頃にはきっと私はレッドコーダーになっていることでしょう。(現在Div1底辺)昨日といた問題103D こういう手の問題で平方分割をするのは典型ですが、この問題はクエリ先読みが大…

CROC Champ 2013 Round 1

この画面で このボタンを押すと、 ↓見たい人はここをドラッグ↓ パソコンが爆発します。

SRM463 Div1Mediumとその他

463Med(500pts) 解法:変な制約から、a 解法が分かったら実装は一瞬でした。制約の1.5以上を1.125以上にすると急に難しくなるらしいです(なぜだろう?) import java.util.*; public class Nisoku{ public double theMax(double[]a){ double ret=0; Arrays.so…

何か

seed: phidnight seed: 383129

Codeforces Beta Round #63 (Div2 Only)

春休みという流れでCodeforcesにノリで初参加。 TopCoderもあわせて久しぶりのDiv2なので嬉しい気分。(ちなみに操作のしかたはよくわかりませんでした)A: Young Physicist 沢山あるベクトル(3次元)の和が0ベクトルになるかどうか判定する。 書くだけ。 #incl…