[Login|Register]
New post

Show post

Search forum

Read post
超时 [ Topic ] 2015-10-01 19:17:04 cmer
心累
#include<stdio.h>
int main(){
    long int m,a,b,i,x;
    while(scanf("%ld %ld %ld",&m,&a,&b)!=EOF){
        if(m==-1&&a==-1&&b==-1) break;
        x=b;
        for(i=1;;i++){
            if(x==m){break;}
            x=x*a+b;
            if(x>9999677) x=x%999967;
        }
        printf("%ld\n",i);
        }

   }
Reply
Title
Message
(64K)
University of Science and Technology of China
Online Judge for ACM/ICPC
Processed in 2.1ms with 2 query(s).