Cod sursa(job #635931)

Utilizator ion824Ion Ureche ion824 Data 19 noiembrie 2011 15:43:17
Problema Zombie Scor 0
Compilator cpp Status done
Runda .com 2011 Marime 0.98 kb
#include<fstream>
#include<string>
using namespace std;
int t[1000005],p,l;
string s;
ifstream fin("zombie.in");

int citire(){
  int aux=0;
  while(p<l && s[p]>='0' && s[p]<='9'){
                  aux=aux*10+s[p]-48;
                  ++p;  
                  }
  while(p<l && (s[p]<'0' || s[p]>'9')){
                           ++p; 
                           }       
  return aux;      
}

int main(void){
    ofstream fout("zombie.out");
    int n,d,k,i=1,j,cost=0; 
    fin>>n>>d>>k; getline(fin,s);
    getline(fin,s); l=s.length(); p=0;
    for(i=1;i<=n;++i)t[i]=citire();
    for(i=1;i<=n;++i)fout<<t[i];
  //  for(i=1;i<=n;++i)fin>>t[i]; fin.close(); i=1;
  /*  while(i<=n){
         j=i+1;       
         while(t[j]-t[i]<d && j<=n)++j;
            if(k<j-i)cost+=k;
              else cost+=j-i;
         i=j;                                                            
                }                
    fout<<cost; fout.close(); */
 return 0;   
}