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 1150. Page Numbers

why, i get compile error
Posted by XMAN 23 Oct 2009 23:57
#include<conio.h>
#include<math.h>
#include<stdio.h>
int k,t[10];
double fonction (int n, int i)
{
       int h;
    if(n==1)
    {
            if(t[n]>=i)
            {
                       return 1;
            }
            else
            {
                return 0;
            }
    }
    else
    {
        if(t[n]>i)
            {
                       return ((pow(10,n-1))+(t[n]*pow(10,n-2))+(fonction(n-1,i)));
            }
        if(t[n]==i)
            {
                       h=int(k/pow(10,n-1));
                       return (((k-(h*pow(10,n-1)))+1)+(t[n]*pow(10,n-2))+(fonction(n-1,i)));
            }
        if(t[n]<i)
            {
                       return ((t[n]*pow(10,n-2))+(fonction(n-1,i)));
            }
    }
}

int main()
{
    int n=0,i=1,j,m,r=1,w=0;
    scanf("%d",&k);
    m=k;
   // double q=1.56;
    while(m!=0)
    {
               n++;
               t[n]=m%10;
               m=m/10;
               //printf("%d",t[n]);


    }
    for(i=0;i<n;i++)
    {
                    w+=pow(10,i);
    }
    r=int(fonction(n,0));
    printf("%d\n",r-w);
    for(i=1;i<10;i++)
    {
    r=int(fonction(n,i));
    printf("%d\n",r);
}
    getch();

return 0;
}
Re: why, i get compile error
Posted by Alexander Samal 30 Jul 2010 04:24
It's not allowed to use <conio.h> and getch().
Read FAQ.