Submission #2006870

Source Code Expand

Copy
```#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
int i,j;
ll a,b;
cin>>a>>b;
int n=b-a+1;
ll dp[40][2048]={};
dp[0][0]=1;

int prime[11]={2,3,5,7,11,13,17,19,23,29,31};//11

rep(i,n){

vector<bool> b(11,false);

ll tmp=a+i;

rep(j,11)if(tmp%prime[j]==0)b[j]=true;

rep(j,2048)if(dp[i][j]){
dp[i+1][j]+=dp[i][j];
bool c=true;
int k,t=0;
rep(k,11){
if((j&(1<<k))!=0 && b[k])c=false;
else if((j&(1<<k))!=0 || b[k])t+=(1<<k);
}
if(c)dp[i+1][t]+=dp[i][j];
}

}

ll ans=0;
rep(i,2048)ans+=dp[n][i];
cout<<ans<<endl;
}
```

#### Submission Info

Submission Time 2018-01-22 01:56:05+0900 C - すぬけそだて――ごはん―― rika0384 C++14 (GCC 5.4.1) 400 1223 Byte AC 2 ms 896 KB

#### Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 s1.txt, s2.txt, s3.txt
All 400 / 400 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, s1.txt, s2.txt, s3.txt
Case Name Status Exec Time Memory
01.txt 1 ms 896 KB
02.txt 1 ms 896 KB
03.txt 2 ms 896 KB
04.txt 2 ms 896 KB
05.txt 2 ms 896 KB
06.txt 2 ms 896 KB
07.txt 1 ms 896 KB
08.txt 1 ms 896 KB
09.txt 2 ms 896 KB
10.txt 2 ms 896 KB
11.txt 2 ms 896 KB
12.txt 2 ms 896 KB
13.txt 2 ms 896 KB
14.txt 2 ms 896 KB
15.txt 2 ms 896 KB
s1.txt 1 ms 896 KB
s2.txt 1 ms 896 KB
s3.txt 2 ms 896 KB