/ Randle /

记录详情

Wrong Answer


  
# 状态 耗时 内存占用
#1 Wrong Answer 53ms 328.0 KiB
#2 Wrong Answer 38ms 452.0 KiB
#3 Wrong Answer 38ms 324.0 KiB
#4 Wrong Answer 37ms 324.0 KiB
#5 Wrong Answer 47ms 324.0 KiB
#6 Wrong Answer 36ms 324.0 KiB
#7 Accepted 3ms 328.0 KiB
#8 Accepted 2ms 324.0 KiB
#9 Wrong Answer 64ms 324.0 KiB
#10 Wrong Answer 66ms 328.0 KiB

代码

#include<bits/stdc++.h>
inline const void read(long long &a)
{
	a=0;
	char c=getchar();
	while(c<'0'||c>'9')c=getchar();
	while(c>='0'&&c<='9')
	{
		a=(a<<1)+(a<<3)+c-'0';
		c=getchar();
	}
}
inline const void write(long long a)
{
	if(a>9)write(a/10);
	putchar(a%10+'0');
}
long long n,m,a[21],ans=0;
int main()
{
	read(n);read(m);
	for(long long i=1;i<=m;i++)read(a[i]);
	long long p,d;
	for(long long i=1;i<=(1<<m)-1;i++)
	{
		p=1;d=-1;
		for(long long j=1;j<=m;j++)
		{
			if(i&(1<<(j-1)))
			{
				d*=-1;
				p*=a[j];
				if(p>n){p=0;break;}
			}
		}
		if(p)ans+=d*n/p;
	}
	write(n-ans);
	return 0;
}

信息

递交者
类型
递交
题目
计数 T1
题目数据
下载
语言
C++
递交时间
2017-10-07 14:18:11
评测时间
2017-10-07 14:22:07
评测机
分数
20
总耗时
390ms
峰值内存
452.0 KiB