标签:limit typedef print oss font 位置 har main pre
Time Limit: 1000MS | Memory Limit: 10000K | |
Total Submissions: 108911 | Accepted: 21866 |
Description
Input
Output
Sample Input
1 2 3 4 5
Sample Output
4
Source
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; typedef long long ll; ll xx,yy,m,n,l; void exgcd(ll a,ll b,ll &g,ll &x,ll &y){ if(b==0){g=a;x=1;y=0;} else{exgcd(b,a%b,g,y,x);y-=x*(a/b);} } int main(int argc, const char * argv[]) { scanf("%lld%lld%lld%lld%lld",&xx,&yy,&m,&n,&l); ll x,y,g; exgcd(n-m,l,g,x,y); if((xx-yy)%g) printf("Impossible"); else{ ll c=xx-yy,b=l,a=n-m; //printf("%lld",(x*(xx-yy)/g%(l/g)+l/g)%(l/g) ); c/=g;b/=g; printf("%lld",(x%b*c%b+b)%b); //printf("%lld",((x%b+b)*c%b+b)%b); } return 0; }
标签:limit typedef print oss font 位置 har main pre
原文地址:http://www.cnblogs.com/candy99/p/5985735.html