2012-10-23から1日間の記事一覧

2150:Matsuzaki Number

AOJ

エラトステネスのふるいで十分な数の素数を求める。 Nより大きい素数の配列を適当な数まで作り それぞれの和を計算した。 #include<iostream> #include<vector> #include<algorithm> using namespace std; int main(void){ vector<int>num,ans; int n,p,prime[1000001]; for(int i=0;i<1000001</int></algorithm></vector></iostream>…

1030:Cubes Without Holes

AOJ

x,y,z座標の値をもつ構造体cubeを作り 入力された列をsetに入れて重複を消し (nの三乗)-(setのサイズ)を出力する。 #include<iostream> #include<algorithm> #include<set> using namespace std; struct cube{ int x,y,z; }; bool operator<(const cube& left, const cube& right){ if(</set></algorithm></iostream>…