Advertisement
Anik_Akash

2 No Q

Oct 28th, 2020
1,185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.42 KB | None | 0 0
  1. //thanks God For Every Thing!
  2. //contest link:
  3.  
  4. //#include<bits/stdc++.h>
  5. #include <iostream>
  6. #include <fstream>
  7. #include <string>
  8. #include <algorithm>
  9. #include <cmath>
  10. #include <cstdio>
  11.  
  12. /*
  13.  
  14.            
  15.  
  16. */
  17. #define pi           acose(-1)
  18. #define flush        cin.ignore(numeric_limits<streamsize>::max(),'\n');
  19. #define wow          ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  20. #define NL           printf("\n")
  21. #define fin          freopen("int.txt","r",stdin);
  22. #define fout         freopen("out.txt","w",stdout);
  23.  
  24.  
  25. using namespace std;
  26.  
  27. typedef long long int ll;
  28. typedef double dl;
  29.  
  30. // ---------------------- slove---------------------------//
  31.  
  32.  
  33. int main()
  34. {
  35.     fin
  36.    fout
  37.    int n;
  38.    cin>>n;
  39.    if(n<20) cout<<"Too Small"<<endl;
  40.    else
  41.    {
  42.        if(n%2==0)
  43.        {
  44.            for(int i=n-1; i>0; i-=2)
  45.            {
  46.                if(i==1)
  47.                {
  48.                    cout<<i<<endl;
  49.                }
  50.                else
  51.                {
  52.                    cout<<i<<"-";
  53.                }
  54.            }
  55.        }
  56.        else
  57.        {
  58.            for(int i=n; i>0; i-=2)
  59.            {
  60.                if(i==1)
  61.                {
  62.                    cout<<i<<endl;
  63.                }
  64.                else
  65.                {
  66.                    cout<<i<<"-";
  67.                }
  68.            }
  69.        }
  70.        
  71.        
  72.    }
  73.    
  74.    
  75.    
  76.     return 0;
  77. }
  78. //author anikaksh;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement