Advertisement
Saleh127

UVA 10174

Jul 10th, 2021
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. //#define endl "\n"
  5. #define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
  6. int main()
  7. {
  8. ios_base::sync_with_stdio(0);
  9. cin.tie(0);
  10. cout.tie(0);
  11.  
  12. char a[20000];
  13. ll n,m,i,j,k,l;
  14.  
  15. while(gets(a))
  16. {
  17.  
  18. if(sscanf(a,"%lld %lld",&n,&m)==2)
  19. {
  20. l=0;
  21.  
  22. if(n>m) swap(n,m);
  23.  
  24. for(i=n; i<=m; i++)
  25. {
  26. if(i%4==2) l++;
  27. }
  28.  
  29. cout<<l<<endl;
  30. }
  31.  
  32. else
  33. {
  34. if(n>=0)
  35. {
  36. n=abs(n);
  37.  
  38. if(n%4==2)
  39. {
  40. cout<<"Bachelor Number."<<endl;
  41. }
  42. else if(n%2)
  43. {
  44. cout<<(n+1)/2<<" "<<n/2<<endl;
  45. }
  46. else
  47. {
  48. cout<<(n/4)+1<<" "<<(n/4)-1<<endl;
  49. }
  50. }
  51.  
  52. else
  53. {
  54. n=abs(n);
  55.  
  56. if(n%4==2)
  57. {
  58. cout<<"Bachelor Number."<<endl;
  59. }
  60. else if(n%2)
  61. {
  62. cout<<n/2<<" "<<(n+1)/2<<endl;
  63. }
  64. else
  65. {
  66. cout<<(n/4)-1<<" "<<(n/4)+1<<endl;
  67. }
  68. }
  69. }
  70. }
  71.  
  72. return 0;
  73. }
  74.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement