ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1688. Team.GOV!

WA3
Posted by Liceum#64_Yurik 28 Feb 2009 15:33
What's wrong in my program? I can't find mistake. Anybody knows it?
#include<fstream>
#include<iostream>
#include<cstdio>
using namespace std;

    long n, m;
    __int64 x, y = 0, n1;

int main (){
    cin >> n >> m;
    n1 = 3*n;
    for (int i = 0; i < m; ++i){
        cin >> x;
        y+=x;
        if (y >= n1){
            cout << "Free after " << i+1 << " times.";
            return 0;
        }
    }
    cout << "Team.GOV!";
    return 0;
}
Re: WA3
Posted by Ivan Zdomskyy 28 Feb 2009 15:49
i got wa #3.why ???
Re: WA3
Posted by Gubarev Valentin (Pskov) 9 Mar 2009 16:33
n1=3*__int64(n);
Re: WA3
Posted by Tolya_wolf 15 Jan 2010 11:23
I have the same problem.

Algorithm:
//-----------------------------------------------
#include<stdio.h>

void main(void){
    int exit,goes,i,sum=0;
    int sums[3000];
    bool free=false;

    scanf("%d %d",&exit,&goes);
    exit*=3;

    for(i=0;i<goes;i++)
        scanf("%d",&sums[i]);


    for(i=0;i<goes;i++)
    {    sum+=sums[i];
        if(sum>=exit)
            {free=true;
            break;}
    }

    if(free==true)
        printf("Free after %d times.",i+1);
    else
        printf("Team.GOV!");

}
//----------------------------------------------
Wrong answer, test No.3
explanation
Posted by Tural Neymanov 12 Mar 2010 00:21
your mistakes are very simple - guy's spent money should overwhelm (not equal!) n.