#include<iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <stack>
#include <queue>
#include <list>
#include <vector>
#include <map>
#include <sstream>
#include <utility>
#include <set>
#include <math.h>
using namespace std;
int main()
{
int i,j,k;
int a,b;
while(scanf("%d %d",&a,&b)==2)
{
if(a<0 && b<0)
break;
int temp_a=a;
int temp_b=b;
int aa=a;
int bb=b;
for(i=1; i<150; i++)
{
temp_a++;
if(temp_a==100)
temp_a=0;
if(temp_a==temp_b)
break;
}
for(j=1; j<=150; j++)
{
if(a==0)
a=100;
a--;
if(a==b)
break;
}
int res=min(i,j);
if(aa==bb)
printf("0\n");
else
cout<<res<<endl;
}
}
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <stack>
#include <queue>
#include <list>
#include <vector>
#include <map>
#include <sstream>
#include <utility>
#include <set>
#include <math.h>
using namespace std;
int main()
{
int i,j,k;
int a,b;
while(scanf("%d %d",&a,&b)==2)
{
if(a<0 && b<0)
break;
int temp_a=a;
int temp_b=b;
int aa=a;
int bb=b;
for(i=1; i<150; i++)
{
temp_a++;
if(temp_a==100)
temp_a=0;
if(temp_a==temp_b)
break;
}
for(j=1; j<=150; j++)
{
if(a==0)
a=100;
a--;
if(a==b)
break;
}
int res=min(i,j);
if(aa==bb)
printf("0\n");
else
cout<<res<<endl;
}
}
No comments:
Post a Comment