/ Randle /

记录详情

Wrong Answer

/in/foo.cc: In function 'int main()':
/in/foo.cc:29:13: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
    if(i&1<<j-1)
            ~^~
# 状态 耗时 内存占用
#1 Wrong Answer 53ms 324.0 KiB
#2 Wrong Answer 49ms 320.0 KiB
#3 Wrong Answer 29ms 456.0 KiB
#4 Wrong Answer 59ms 444.0 KiB
#5 Wrong Answer 55ms 324.0 KiB
#6 Wrong Answer 47ms 324.0 KiB
#7 Accepted 1ms 324.0 KiB
#8 Accepted 1ms 320.0 KiB
#9 Wrong Answer 60ms 328.0 KiB
#10 Wrong Answer 65ms 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)
			{
				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:10:00
评测时间
2017-10-07 14:10:00
评测机
分数
20
总耗时
425ms
峰值内存
456.0 KiB