Advertisement
Anik_Akash

2757

Oct 29th, 2020
2,038
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.56 KB | None | 0 0
  1. //thanks God For Every Thing!
  2. //contest link:
  3.  
  4. //#include<bits/stdc++.h>
  5. #include<iostream>
  6. #include<string>
  7. #include<algorithm>
  8. #include<cstdio>
  9. #define pi           acose(-1)
  10. #define flush        cin.ignore(numeric_limits<streamsize>::max(),'\n');
  11. #define wow          ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  12. #define NL           printf("\n")
  13.  
  14. using namespace std;
  15.  
  16. typedef long long int           ll;
  17. typedef double                  dl;
  18.  
  19. // ---------------------- slove---------------------------//
  20.  
  21. int int_ln(int x);
  22.  
  23. int main()
  24. {
  25.     int a, b, c, i;
  26.     cin>>a>>b>>c;
  27.     cout<<"A = "<<a<<", B = "<<b<<", C = "<<c<<endl;
  28.  
  29.     int ln1, ln2, ln3;
  30.  
  31.     ln1 = int_ln(a);
  32.     ln2 = int_ln(b);
  33.     ln3 = int_ln(c);
  34. //----------------space print-----------//
  35.     if(a<0)
  36.     {
  37.         cout<<"A = ";
  38.         for( i=1; i<=9-ln1; i++)
  39.         {
  40.             cout<<" ";
  41.         }
  42.         cout<<a<<",";
  43.     }
  44.     else
  45.     {
  46.  
  47.         cout<<"A = ";
  48.         for( i=1; i<=10-ln1; i++)
  49.         {
  50.             cout<<" ";
  51.         }
  52.         cout<<a<<",";
  53.     }
  54.  
  55.     cout<<" B = ";
  56.     for( i=1; i<=10-ln2; i++)
  57.     {
  58.         cout<<" ";
  59.     }
  60.     cout<<b<<",";
  61.  
  62.     cout<<" C = ";
  63.     for( i=1; i<=10-ln3; i++)
  64.     {
  65.         cout<<" ";
  66.     }
  67.     cout<<c;
  68.     NL;
  69. //-----------------zero print---------------//
  70.  
  71.     if(a<0)
  72.     {
  73.         cout<<"A = -";
  74.         for( i=1; i<=9-ln1; i++)
  75.         {
  76.             cout<<"0";
  77.         }
  78.         cout<<abs(a)<<",";
  79.     }
  80.     else
  81.     {
  82.         cout<<"A = ";
  83.         for( i=1; i<=10-ln1; i++)
  84.         {
  85.             cout<<"0";
  86.         }
  87.         cout<<a<<",";
  88.     }
  89.  
  90.  
  91.     cout<<" B = ";
  92.     for( i=1; i<=10-ln2; i++)
  93.     {
  94.         cout<<"0";
  95.     }
  96.     cout<<b<<",";
  97.  
  98.     cout<<" C = ";
  99.     for( i=1; i<=10-ln3; i++)
  100.     {
  101.         cout<<"0";
  102.     }
  103.     cout<<c;
  104.     NL;
  105. //---------------last pace---------//
  106.     if(a<0)
  107.     {
  108.         cout<<"A = "<<a;
  109.         for( i=1; i<=9-ln1; i++)
  110.         {
  111.             cout<<" ";
  112.         }
  113.         cout<<",";
  114.     }
  115.     else
  116.     {
  117.         cout<<"A = "<<a;
  118.         for( i=1; i<=10-ln1; i++)
  119.         {
  120.             cout<<" ";
  121.         }
  122.         cout<<",";
  123.     }
  124.  
  125.  
  126.     cout<<" B = "<<b;
  127.     for( i=1; i<=10-ln2; i++)
  128.     {
  129.         cout<<" ";
  130.     }
  131.     cout<<",";
  132.  
  133.     cout<<" C = "<<c;
  134.     for( i=1; i<=10-ln3; i++)
  135.     {
  136.         cout<<" ";
  137.     }
  138.  
  139.     NL;
  140.  
  141.     return 0;
  142. }
  143. int int_ln(int x)
  144. {
  145.     int cnt=0, num;
  146.     while(x!=0)
  147.     {
  148.         cnt++;
  149.         num=x%10;
  150.         x/=10;
  151.     }
  152.  
  153.     return cnt;
  154. }
  155.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement