Submission #144606


Source Code Expand

Copy
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>
 
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
 
using namespace std;
 
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
 
const double EPS=1e-9;
 
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

const int MAX_N = 10000000;

vector<int> prime;
bool is_prime[MAX_N+1];

// n以下の素数を生成する
void create_prime(int n){
	// 初期化
	is_prime[0] = is_prime[1] = false;
	for(int i=2;i<=n;i++){
		is_prime[i] = true;
	}
	
	for(int i=2;i<=n;i++){
		if(is_prime[i]){
			prime.push_back(i);
			for(int j=2*i;j<=n;j+=i){
				is_prime[j] = false;
			}
		}
	}
}

int main(){
	prime.push_back(0);
	create_prime(150);
	cout << 150 << endl;
	rep(i,150){
		int mas = 0;
		int sub = 0;
		rep(j,150){
			if(j<i){
				cout << ".";
			}else if(prime[mas] == sub){
				mas++;
				sub = 0;
				cout << "O";
			}else{
				cout << ".";
				sub++;
			}
		}
		cout << endl;
	}
}

Submission Info

Submission Time
Task D - ほんとうのたたかい
User igaxx
Language C++ (G++ 4.6.4)
Score 0
Code Size 1536 Byte
Status WA
Exec Time 23 ms
Memory 924 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
WA × 1
Set Name Test Cases
All test.txt
Case Name Status Exec Time Memory
test.txt WA 23 ms 924 KB