比赛总结

· · 个人记录

t1

题意

我在第n周的时候每天会获得n个金币要多少天金币达到q枚

分析

先二分查找需要多少周数,再加上剩下几天获得的金币

代码

#include<bits/stdc++.h>
#define int unsigned long long
using namespace std;
int n,k=1,tot,ans;
signed main(){
    cin>>n;
    int l=1,r=1e12;
    while(l+1<r){
        int mid=(l+r)/2;
        if(7*mid*(mid+1)/2<=n){
            l=mid;
        }else{
            r=mid;
        }
    }
    int px=0; 
    int x=n-7*r*(r+1)/2;
    if(x%(r+1)==0)px=x/(r+1);
    else px=x/(r+1)+1;
    cout<<r*7+px;
    return 0;
}

神奇报错大赏

t2

const int INF=1e16+5;

t3

t4

const int INF=1e10;

总结

真爱生命,远离02

十年OI一场空,开个1e16见祖宗