QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#31747 | #21643. 多测不给大样例问题 | gsh# | Compile Error | / | / | Python2 | 2.3kb | 2022-05-12 09:59:18 | 2022-05-18 04:29:06 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2022-05-18 04:29:06]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2022-05-12 09:59:18]
- 提交
answer
#include<map>
#include<set>
#include<queue>
#include<deque>
#include<cmath>
#include<ctime>
#include<bitset>
#include<vector>
#include<cstdio>
#include<string>
#include<cassert>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
#define pc putchar
#define sp pc(' ')
#define en pc('\n')
#define gc getchar()
#define lb lower_bound
#define ub upper_bound
#define eb emplace_back
#define fs fflush(stdout)
#define ump unordered_map
#define pq priority_queue
#define clz __builtin_clz
#define ctz __builtin_ctz
#define sz(x) (int)x.size()
#define np next_permutation
#define clzl __builtin_clzll
#define par __builtin_parity
#define ctzl __builtin_ctzll
#define ppc __builtin_popcount
#define parl __builtin_parityll
#define all(x) x.begin(),x.end()
#define ppcl __builtin_popcountll
#define fpi(x) freopen(x,"r",stdin)
#define fpo(x) freopen(x,"w",stdout)
#define ms(x,y) memset(x,y,sizeof(x))
#define dbg(x) cerr<<"In Line "<<__LINE__<<' '<<#x<<'='<<x<<'\n'
template<class T> inline T &re(T &x){
x=0;int f=1;char ch=gc;
while(ch<48||ch>57){if(ch==45) f=-f;ch=gc;}
while(ch>47&&ch<58) x=(x<<1)+(x<<3)+(ch^48),ch=gc;
return x*=f;
}
template<class T> inline void pr(T x){
static char buf[40];static int cnt=0;
if(x<0) pc(45),x=-x;
do buf[++cnt]=x%10^48;while(x/=10);
do pc(buf[cnt--]);while(cnt);
}
#define mod 998244353
#define inf 0x3f3f3f3f
bool del[61];
int s[61],top,k;
ll l,r,ans;
inline ll gcd(ll x,ll y){ll z;while(y) z=x,x=y,y=z%y;return x;}
inline ll calc(ll x,int k,ll y){return x/k/(y/gcd(k,y));}
inline ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
void dfs(int x,int cnt,ll now,bool flag){
if(now>r) return ;
if(flag){
if(cnt&1) ans+=calc(r,k,now)-calc(l-1,k,now);
else ans-=calc(r,k,now)-calc(l-1,k,now);
}
if(x<top) dfs(x+1,cnt+1,lcm(now,s[x+1]),1),dfs(x+1,cnt,now,0);
}
void solve(){
ll n=re(n);re(k),ans=n/k;int i,j;ms(del,0);
for(i=k-1;i>1;i--){
l=n*(i-1)+i-1,r=n*i+i-1;
for(j=2;j*i<k;j++) del[i*j]=1;top=0;
for(j=k-1;j>=i;j--) if(!del[j]) s[++top]=j;
dfs(0,0,1,0);
}pr(ans),en;
}
int main(){
int t=re(t);
while(t--) solve();
return 0;
}
详细
File "answer.code", line 17 using namespace std; ^ SyntaxError: invalid syntax