[text] write digits

Viewer

copydownloadembedprintName: write digits
  1. #include <iostream>
  2. #include <fstream>
  3. #include <cmath>
  4. #include <algorithm>
  5. #include <cstring>
  6. #include <iomanip>
  7. #define dim 1000000007
  8. #define ull unsigned long long
  9. using namespace std;
  10. ifstream fin ("date.in");
  11. ofstream fout ("date.out");
  12.  
  13.  
  14. int main()
  15. {
  16.     int nrcif=0, i;
  17.     long long n, invers=0;
  18.     /*
  19.     declar n si invers de tip long long deoarece la restrictiile problemei este specificat ca n<=10^10;
  20.     10^10=10000000000, care este mai mare decat limita int-ului (in jur de 2 miliarde)
  21.     */
  22.     cin>>n;
  23.     //fac inversul ca sa pot sa afisez de la prima cifra + numarul de cifre
  24.     while (n)
  25.     {
  26.         invers=invers*10+n%10;
  27.         n=n/10;
  28.         nrcif++;
  29.     }
  30.     //parcurg numarul
  31.     for (i=1;i<=nrcif;i++)
  32.     {
  33.         //fac un fel de pattern pentru fiecare cifra
  34.         //afisez efectiv forma cifrei aratata in exemplu
  35.         if (invers%10==0)
  36.         {
  37.             cout<<"@@@@@"<<endl;
  38.             cout<<'@'<<"   "<<'@'<<endl;
  39.             cout<<'@'<<"   "<<'@'<<endl;
  40.             cout<<'@'<<"   "<<'@'<<endl;
  41.             cout<<"@@@@@";
  42.             cout<<endl<<endl;
  43.         }
  44.         if (invers%10==1)
  45.         {
  46.             cout<<"  "<<'@'<<endl;
  47.             cout<<' '<<'@'<<'@'<<endl;
  48.             cout<<"  "<<'@'<<endl;
  49.             cout<<"  "<<'@'<<endl;
  50.             cout<<"@@@@@";
  51.             cout<<endl<<endl;
  52.         }
  53.         if (invers%10==2)
  54.         {
  55.             cout<<"@@@@"<<endl;
  56.             cout<<'@'<<' '<<' '<<'@'<<endl;
  57.             cout<<' '<<' '<<'@'<<endl;
  58.             cout<<' '<<'@'<<endl;
  59.             cout<<"@@@@";
  60.             cout<<endl<<endl;
  61.         }
  62.         if (invers%10==3)
  63.         {
  64.             cout<<"@@@@@"<<endl;
  65.             cout<<"    "<<'@'<<endl;
  66.             cout<<"@@@@@"<<endl;
  67.             cout<<"    "<<'@'<<endl;
  68.             cout<<"@@@@@";
  69.             cout<<endl<<endl;
  70.         }
  71.         if (invers%10==4)
  72.         {
  73.             cout<<'@'<<"   "<<'@'<<endl;
  74.             cout<<'@'<<"   "<<'@'<<endl;
  75.             cout<<"@@@@@"<<endl;
  76.             cout<<"    "<<'@'<<endl;
  77.             cout<<"    "<<'@';
  78.             cout<<endl<<endl;
  79.         }
  80.         if (invers%10==5)
  81.         {
  82.             cout<<"@@@@@"<<endl;
  83.             cout<<'@'<<endl;
  84.             cout<<"@@@@@"<<endl;
  85.             cout<<"    "<<'@'<<endl;
  86.             cout<<"@@@@@";
  87.             cout<<endl<<endl;
  88.         }
  89.         if (invers%10==6)
  90.         {
  91.             cout<<"@@@@@"<<endl;
  92.             cout<<'@'<<endl;
  93.             cout<<"@@@@@"<<endl;
  94.             cout<<'@'<<"   "<<'@'<<endl;
  95.             cout<<"@@@@@";
  96.             cout<<endl<<endl;
  97.         }
  98.         if (invers%10==7)
  99.         {
  100.             cout<<"@@@@"<<endl;
  101.             cout<<"   "<<'@'<<endl;
  102.             cout<<"  "<<"@@@"<<endl;
  103.             cout<<"   "<<'@'<<endl;
  104.             cout<<"   "<<'@';
  105.             cout<<endl<<endl;
  106.         }
  107.         if (invers%10==8)
  108.         {
  109.             cout<<"@@@@@"<<endl;
  110.             cout<<'@'<<"   "<<'@'<<endl;
  111.             cout<<"@@@@@"<<endl;
  112.             cout<<'@'<<"   "<<'@'<<endl;
  113.             cout<<"@@@@@";
  114.             cout<<endl<<endl;
  115.         }
  116.         if (invers%10==9)
  117.         {
  118.             cout<<"@@@@@"<<endl;
  119.             cout<<'@'<<"   "<<'@'<<endl;
  120.             cout<<"@@@@@"<<endl;
  121.             cout<<"    "<<'@'<<endl;
  122.             cout<<"    "<<'@';
  123.             cout<<endl<<endl;
  124.         }
  125.         invers=invers/10;
  126.     }
  127. }
  128.  

Editor

You can edit this paste and save as new:


File Description
  • write digits
  • Paste Code
  • 26 Nov-2020
  • 3.42 Kb
You can Share it: