1 条题解

  • 1
    @ 2023-12-20 17:33:24
    #include<bits/stdc++.h>
    using namespace std;
    #define ll long long//亲测不加会WA
    queue<ll> q2;
    queue<ll> q3;
    queue<ll> q5;
    ll fi()
    {
    	return min(min(q2.front(),q3.front()),q5.front());
    }
    int n;
    ll x;
    int main()
    {
    	scanf("%d",&n);
    	q2.push(2);
    	q3.push(3);
    	q5.push(5);
    	if(n==1)//毫无意义的特判 数据没有
    	{
    		cout<<1<<endl;
    		return 0;
    	}
    	for(int i=1;i<n;i++)
    	{
    		x=fi();
    		if(q2.front()==x) q2.pop();
    		if(q3.front()==x) q3.pop();
    		if(q5.front()==x) q5.pop();
    		q2.push(x*2);
    		q3.push(x*3);
    		q5.push(x*5);
    	}
    	cout<<x<<endl;
    	return 0;
    }
    
    • 1

    信息

    ID
    631
    时间
    1000ms
    内存
    128MiB
    难度
    3
    标签
    递交数
    24
    已通过
    10
    上传者