www.programming-challenges.com 이 사이트 아시는분..

구청공익의 이미지

#include<stdio.h>

int main()
{
        int n,i;
        int a,aa,ii,b,c,d,count=0;
        scanf("%d",&n);
        
        while(n-->0)
        {
                count=0;
                scanf("%d %d",&a,&b);
                aa=a;
                c=(aa+b)/2;

                for(i=1 ; (a+i)<=c  ; i++)
                {
                        a+=i;
                /* printf("%dn",a); */
                        count++;
                }
                d=c-a;
                if(d==0)
                        i=i+1;
                if(i<=2*d)
                {
                        ii=i;
                        a+=ii;
                        /* printf("%dn",a); */
                        count++;
                        d=2*d-ii;
                        i++;
                }
                        
                i-=2;
                for(;a+i<=b && i>0 && a<=b ;--i)
                {
                        if(i==d)
                        {
                                a+=i;
                        /* printf("%dn",a); */ 
                                count++;
                        }
                        if(a==b)
                                break;
                        a+=i;
                        /* printf("%dn",a); */ 
                        count++;
                }
                if(a<b)
                {
                        while(a<b){
                        a+=1;
                        /* printf("%dn",a); */
                        count++;
                        }
                }
                
                printf("%dn",count);
        }
        return 0;
}
 

http://www.programming-challenges.com/pg.php?page=downloadproblem&probid=110608&format=html
이 문제를 풀어본건데요.
이 코드를 심사로봇에 제출하면 Restricted function 라는 에러가 나옵니다.
왜 이런 에러가 나올까요? c 표준함수만 사용했는데..
addnull의 이미지

이거, 오랜만에 불타오르게 하는군요.. +_+

전, ACM에 세번 출전했는데..
마지막으로 출전했을때 다른 팀 사람과 이야기하다가
이 싸이트와 책을 알게됐습니다.
그때 그 팀은 여기 문제 800set를 풀고 왔다고하더군요...;;;

제가 소스 붙여넣기 창에 넣고 테스트해보니
말씀하신 에러는 없고 채점은 제대로 됩니다.

2005년 11월 8일.