結果

問題 No.546 オンリー・ワン
ユーザー vjudge1
提出日時 2025-05-16 15:32:29
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 621 bytes
コンパイル時間 1,417 ms
コンパイル使用メモリ 162,828 KB
実行使用メモリ 16,072 KB
最終ジャッジ日時 2025-05-16 15:32:35
合計ジャッジ時間 5,361 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 2 TLE * 1 -- * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define int long long
#define PII pair< int, int >
using namespace std;
signed main()
{
	int n, L, R, num[15];
	cin >> n >> L >> R;
	for(int i = 1; i <= n; i++) cin >> num[i];
	if(n == 1) 
	{
		while(L%num[1]) L++;
		while(R%num[1]) R--;
		cout << (R-L)/num[1]+1;
		return 0;
	}
	if(L==R)
	{
		int zc=0;
		for(int i = 1; i <= n; i++)
		{
			if(L%num[i]==0) zc++;
		}
		if(zc == 1) cout << 1;
		else cout << 0;
		return 0;
	}
	int cnt = 0;
	for(int i = L; i <= R; i++)
	{
		int zc=0;
		for(int j = 1; j <= n; j++)
		{
			if(i%num[j]==0) zc++;
		}
		if(zc == 1) cnt++;
	}
	cout << cnt;
	return 0;
}
0