Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <algorithm>
- using namespace std;
- long long int c,n,m,a,sol;
- int main()
- {
- freopen("amprenta.in","r",stdin);
- freopen("amprenta.out","w",stdout);
- scanf("%lld",&c);
- if(c==1)
- {
- scanf("%lld",&n);
- n%=11;
- if(n>=6)
- n=11-n;
- printf("%lld\n",n);
- }
- else
- {
- scanf("%lld%lld%lld",&n,&m,&a);
- if(n>m)
- swap(n,m);
- while(n%11!=0 && n<=m)
- {
- if(n%11==a || 11-n%11==a)
- sol++;
- n++;
- }
- while(m%11!=0 && m>=n)
- {
- if(m%11==a || 11-m%11==a)
- sol++;
- m--;
- }
- if(n<=m)
- if(!a)
- sol+=m/11-n/11+1;
- else
- sol+=2*(m/11-n/11);
- printf("%lld\n",sol);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement