Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

确实够娱乐, 是写完代码替换的, 还是直接起的这些变量名?

Posted by deitytoday at 2011-08-22 16:48:51 on Problem 2891
In Reply To:发个代码以供娱乐~ Posted by:gnaggnoyil at 2009-11-02 18:55:32
> #include <cstdio>
> #include <cstdlib>
> #include <cstring>
> #include <cmath>
> #define maxn 200001
> long long holy_shit[maxn],naga_siren[maxn],farm_roshan[maxn],billzard_cannon[maxn];
> long long n,ans,cD_zhou_YY,c,ice_frog;
> bool flag=false;
> long long first_blood(long long a,long long b,long long &x,long long &y){
>   if(b==0)
>     return x=1,y=0,a;
>   long long res=first_blood(b,a%b,x,y);
>   long long t=x;
>   x=y,y=t-(a/b)*y;
>   return res;
> }
> long long rampage(long long a,long long b,long long n){
>   long long d,x,y,e;
>   d=first_blood(a,n,x,y);
>   if(b%d!=0)
>     return -1;
>   e=x*(b/d)%n;
>   return (e+n)%n;
> }
> long long wicked_sick(long long a,long long b){
>   long long ans,x,y;
>   ans=first_blood(a,b,x,y);
>   return (a/ans)*b;
> }
> int main(){
>   for(;scanf("%I64d",&n)!=EOF;ans=1,flag=false,ice_frog=0){
>     for(int i=1;i<=n;i++)
>       scanf("%I64d%I64d",&holy_shit[i],&naga_siren[i]);
>     farm_roshan[1]=naga_siren[1],billzard_cannon[1]=holy_shit[1];
>     for(int i=2;i<=n;i++){
>       ice_frog=rampage(billzard_cannon[i-1],naga_siren[i]-farm_roshan[i-1],holy_shit[i]);
>       if(ice_frog+1==0){
>         flag=true;
>         continue;
>       }
>       cD_zhou_YY=wicked_sick(billzard_cannon[i-1],holy_shit[i]);
>       c=farm_roshan[i-1]+billzard_cannon[i-1]*ice_frog;
>       farm_roshan[i]=c,billzard_cannon[i]=cD_zhou_YY;
>     }
>     printf("%I64d\n",((flag)?(-1):((c+cD_zhou_YY)%cD_zhou_YY)));
>   }
>   return 0;
> }

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator