Google Code Jam qualification Round A water

Source: Internet
Author: User

Test instructions: give you a sequence from 0-n initial position of 0, only from I walk to i+1 you need to have the number >= i+1, each location has a[i] individual, ask you how many people you need to go to N.

Problem-Solving ideas: violence

Problem Solving Code:

1 //File name:a.cpp2 //Author:darkdream3 //Created time:2015 April 11 Saturday 23:06 57 seconds4 5#include <vector>6#include <list>7#include <map>8#include <Set>9#include <deque>Ten#include <stack> One#include <bitset> A#include <algorithm> -#include <functional> -#include <numeric> the#include <utility> -#include <sstream> -#include <iostream> -#include <iomanip> +#include <cstdio> -#include <cmath> +#include <cstdlib> A#include <cstring> at#include <ctime> - #defineLL Long Long -  - using namespacestd; - intN; - intT; in inttmp; - intMain () { toFreopen ("a-large.in","R", stdin); +Freopen ("Output","W", stdout); -scanf"%d",&t); the     for(intCA =1; CA <= t; CA + +) *    { $scanf"%d",&n);Panax Notoginseng       intsum =0; -       intAns =0;  the        for(intI=0; I <= N;i + +) +       { Ascanf"%1d",&tmp); the          if(Sum <i) +          { -Ans + = i-sum; $sum =i; $          } -Sum + =tmp; -       } theprintf"Case #%d:%d\n", Ca,ans); -    }Wuyi return 0; the}
View Code

Google Code Jam qualification Round A water

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.