/ Randle /

记录详情

Wrong Answer


  
# 状态 耗时 内存占用
#1 Wrong Answer 114ms 448.0 KiB
#2 Wrong Answer 111ms 324.0 KiB
#3 Wrong Answer 113ms 324.0 KiB
#4 Wrong Answer 92ms 320.0 KiB
#5 Wrong Answer 92ms 328.0 KiB
#6 Wrong Answer 138ms 448.0 KiB
#7 Accepted 3ms 324.0 KiB
#8 Accepted 1ms 320.0 KiB
#9 Wrong Answer 95ms 324.0 KiB
#10 Wrong Answer 92ms 320.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)))
			{
				//write(j);putchar(' ');
				d*=-1;
				p*=a[j];
				//if(p>n){p=0;break;}
			}
		}
		//printf("\n");
		if(p)ans+=d*n/p;
	}
	write(n-ans);
	return 0;
}

信息

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