zoukankan      html  css  js  c++  java
  • 【Codeforces Round #428 (Div. 2) A】Arya and Bran

    Link:

    Description

    Solution

    傻逼题

    NumberOf WA


    Reviw


    Code

    #include <bits/stdc++.h>
    using namespace std;
    #define lson l,m,rt<<1
    #define rson m+1,r,rt<<1|1
    #define LL long long
    #define rep1(i,a,b) for (int i = a;i <= b;i++)
    #define rep2(i,a,b) for (int i = a;i >= b;i--)
    #define mp make_pair
    #define pb push_back
    #define fi first
    #define se second
    #define ms(x,y) memset(x,y,sizeof x)
    #define ri(x) scanf("%d",&x)
    #define rl(x) scanf("%lld",&x)
    #define rs(x) scanf("%s",x+1)
    #define oi(x) printf("%d",x)
    #define ol(x) printf("%lld",x)
    #define oc putchar(' ')
    #define os(x) printf(x)
    #define all(x) x.begin(),x.end()
    #define Open() freopen("F:\rush.txt","r",stdin)
    #define Close() ios::sync_with_stdio(0)
    
    typedef pair<int,int> pii;
    typedef pair<LL,LL> pll;
    
    const int dx[9] = {0,1,-1,0,0,-1,-1,1,1};
    const int dy[9] = {0,0,0,-1,1,-1,1,-1,1};
    const double pi = acos(-1.0);
    const int N = 110;
    
    int n,k;
    
    int main(){
        //Open();
        //Close();
        ri(n),ri(k);
        int now = 0,cur = 0;
        rep1(i,1,n){
            int x;
            ri(x);
            cur+=x;
            now += min(cur,8);
            cur -= min(cur,8);
            if (now >= k){
                oi(i);puts("");
                return 0;
            }
        }
        puts("-1");
        return 0;
    }
  • 相关阅读:
    4-18
    Vue学习 2017-4-9
    前端杂谈
    不错的博客哦!
    待整理知识杂项
    Vue学习历程
    王工的权限理解
    【NX二次开发】图标图像
    【转】C++怎么读写windows剪贴板的内容?比如说自动把一个字符串复制.
    获取计算机名
  • 原文地址:https://www.cnblogs.com/AWCXV/p/7626123.html
Copyright © 2011-2022 走看看