提出 #929195


ソースコード 拡げる

#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define FILL(a,x) memset(a,x,sizeof(a))
#define foreach( gg,ii ) for( typeof(gg.begin()) ii=gg.begin();ii!=gg.end();ii++)
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define sz(a) int((a).size())
#define N 1000010
#define MAX 30
#define mod 1000000007
#define REP(i,a) for(int i=0;i<a;++i)
#define REPP(i,a,b) for(int i=a;i<b;++i)
#define all(a) a.begin(),a.end()
const ll INF = 1e18+1;

inline void solve(ll &x, ll &y, ll a, ll b)
{
	ll l=1,r=INF/(a+b),mid;
	while(l<r)
	{
		mid=(l+r)/2;
		if (a*mid>=x&&b*mid>=y) r=mid;
		else l=mid+1;
	}
	mid=(l+r)/2;
	x=a*mid;
	y=b*mid;
}

int main()
{
	ll n,x,y,t,a;
	scanf("%lld",&n);
	REP(i,n)
	{
		scanf("%lld%lld",&t,&a);
		if (!i)
		{
			x=t;
			y=a;
		}
		else
			solve(x,y,t,a);
	}
	printf("%lld\n",x+y);
return 0;
}

提出情報

提出日時
問題 C - AtCoDeerくんと選挙速報
ユーザ TerryMcGinnis
言語 C++14 (GCC 5.4.1)
得点 300
コード長 1017 Byte
結果 AC
実行時間 3 ms
メモリ 256 KiB

コンパイルエラー

./Main.cpp: In function ‘int main()’:
./Main.cpp:40:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&n);
                  ^
./Main.cpp:43:26: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld%lld",&t,&a);
                          ^

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 3
AC × 15
セット名 テストケース
Sample 0_000.txt, 0_001.txt, 0_002.txt
All 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt
ケース名 結果 実行時間 メモリ
0_000.txt AC 2 ms 256 KiB
0_001.txt AC 2 ms 256 KiB
0_002.txt AC 2 ms 256 KiB
1_003.txt AC 2 ms 256 KiB
1_004.txt AC 2 ms 256 KiB
1_005.txt AC 2 ms 256 KiB
1_006.txt AC 2 ms 256 KiB
1_007.txt AC 2 ms 256 KiB
1_008.txt AC 2 ms 256 KiB
1_009.txt AC 2 ms 256 KiB
1_010.txt AC 2 ms 256 KiB
1_011.txt AC 2 ms 256 KiB
1_012.txt AC 2 ms 256 KiB
1_013.txt AC 3 ms 256 KiB
1_014.txt AC 3 ms 256 KiB