結果

問題 No.546 オンリー・ワン
ユーザー kotamanegikotamanegi
提出日時 2019-05-08 22:58:35
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,456 bytes
コンパイル時間 785 ms
コンパイル使用メモリ 98,788 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-09-14 17:25:26
合計ジャッジ時間 1,739 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 1 ms
4,380 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include <map>
#include <fstream>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <assert.h>
#include <complex>
#include <omp.h>
using namespace std;
#define eps 0.000001
#define LONG_INF 10000000000000
#define GOLD 1.61803398874989484820458
#define seg_size 65536*4
#define REP(i,n) for(long long i = 0;i < n;++i)
unsigned long xor128() {
	static unsigned long x = time(NULL), y = 362436069, z = 521288629, w = 88675123;
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
int main(){
#define int long long
	int n,l,h;
	cin >> n >> l >> h;
	vector<int> a;
	REP(i,n){
		int b;
		cin >> b;
		a.push_back(b);
	}
	long long ans = 0;
	for(int i = 1;i < (1 << n);++i){
		int tea = 0;
		long long hoge = 0;
		long long nya = 1;
		int now = i;
		for(int q = 0;now != 0;++q){
			if(now % 2 == 1){
				nya *= a[q];
				tea++;
				if(nya > h) break;
			}
			now /= 2;
		}
		hoge = h / nya - l / nya;
		if(tea % 2 == 1){
			ans += tea * hoge;
		}else{
			ans -= tea * hoge;
		}
	}
	cout << ans << endl;
	return 0;
}
0