Advertisement
TAHMID37

Lab_task_1__2.0

Sep 26th, 2020 (edited)
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.52 KB | None | 0 0
  1. //Task 1
  2.  
  3. /*  TAHMID RAHMAN
  4.     DAMIAN FOREVER
  5.      MATH LOVER
  6.     NEVER GIVE UP
  7. */
  8. #include<bits/stdc++.h>
  9. using namespace std;
  10. #define pi acos(-1.0)
  11. #define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
  12. #define ll long long
  13. #define pb push_back
  14. #define fi first
  15. #define se second
  16. #define in insert
  17. #define mp make_pair
  18. #define GCD(a,b) __gcd(a,b);
  19. #define endl "\n"
  20. #define FRU freopen("out.txt","w",stdout)
  21. #define FRO freopen("in.txt","r",stdin)
  22. #define INFLL 9223372036854775807
  23. #define debug 0
  24. #define MAXN   100001
  25. #define ar array
  26. const int mxN=2e5;
  27. const int MOD=1e9+7;
  28. bool sortbysec(const pair<int,int> &a,const pair<int,int> &b){return (a.second < b.second);}
  29. //Don't hesitate to ask me if you don't understand my code.......Happy coding,Tahmid...;
  30.  
  31. int main()
  32. {
  33.     fastio;
  34.     ll n;
  35.     cin>>n;
  36.     if(n&1)
  37.     {
  38.         cout<<"odd"<<endl;
  39.     }
  40.     else
  41.         cout<<"even"<<endl;
  42.  
  43. }
  44.  
  45. //Task 2
  46.  
  47. /*  TAHMID RAHMAN
  48.     DAMIAN FOREVER
  49.      MATH LOVER
  50.     NEVER GIVE UP
  51. */
  52. #include<bits/stdc++.h>
  53. using namespace std;
  54. #define pi acos(-1.0)
  55. #define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
  56. #define ll long long
  57. #define pb push_back
  58. #define fi first
  59. #define se second
  60. #define in insert
  61. #define mp make_pair
  62. #define GCD(a,b) __gcd(a,b);
  63. #define endl "\n"
  64. #define FRU freopen("out.txt","w",stdout)
  65. #define FRO freopen("in.txt","r",stdin)
  66. #define INFLL 9223372036854775807
  67. #define debug 0
  68. #define MAXN   100001
  69. #define ar array
  70. const int mxN=2e5;
  71. const int MOD=1e9+7;
  72. bool sortbysec(const pair<int,int> &a,const pair<int,int> &b){return (a.second < b.second);}
  73. //Don't hesitate to ask me if you don't understand my code.......Happy coding,Tahmid...;
  74.  
  75. int main()
  76. {
  77.     ll n;
  78.     cin>>n;
  79.     if(n<10)
  80.     {
  81.         cout<<1<<endl;
  82.     }
  83.     else if(n>=10&&n<100)
  84.     {
  85.         cout<<2<<endl;
  86.     }
  87.     else if(n>=100&&n<1000)
  88.     {
  89.         cout<<3<<endl;
  90.     }
  91.     else if(n>=1000&&n<10000)
  92.     {
  93.         cout<<4<<endl;
  94.     }
  95.     else if(n>=10000&&n<100000)
  96.     {
  97.         cout<<5<<endl;
  98.     }
  99.     else if(n==1000000)
  100.     {
  101.         cout<<6<<endl;
  102.     }
  103.  
  104.  
  105.  
  106.  
  107.  
  108. }
  109.  
  110.  
  111.  
  112. //Task 3
  113.  
  114.  
  115. /*  TAHMID RAHMAN
  116.     DAMIAN FOREVER
  117.      MATH LOVER
  118.     NEVER GIVE UP
  119. */
  120. #include<bits/stdc++.h>
  121. using namespace std;
  122. #define pi acos(-1.0)
  123. #define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
  124. #define ll long long
  125. #define pb push_back
  126. #define fi first
  127. #define se second
  128. #define in insert
  129. #define mp make_pair
  130. #define GCD(a,b) __gcd(a,b);
  131. #define endl "\n"
  132. #define FRU freopen("out.txt","w",stdout)
  133. #define FRO freopen("in.txt","r",stdin)
  134. #define INFLL 9223372036854775807
  135. #define debug 0
  136. #define MAXN   100001
  137. #define ar array
  138. const int mxN=2e5;
  139. const int MOD=1e9+7;
  140. bool sortbysec(const pair<int,int> &a,const pair<int,int> &b){return (a.second < b.second);}
  141. //Don't hesitate to ask me if you don't understand my code.......Happy coding,Tahmid...;
  142. int main()
  143. {
  144.     ll n,i,x;
  145.     cin>>n;
  146.     map<ll,ll>m;
  147.     for(i=0;i<n;i++)
  148.     {
  149.         cin>>x;
  150.         m[x]++;
  151.     }
  152.     auto it=m.begin();
  153.     ll maxs=0,tot=0;
  154.     for(it;it!=m.end();it++)
  155.     {
  156.         if(it->se >tot)
  157.         {
  158.             tot=it->se;
  159.             maxs=it->fi;
  160.         }
  161.     }
  162.     cout<<maxs<<endl;
  163.  
  164.  
  165.  
  166. }
  167.  
  168.  
  169. //Task 4
  170.  
  171. /*  TAHMID RAHMAN
  172.     DAMIAN FOREVER
  173.      MATH LOVER
  174.     NEVER GIVE UP
  175. */
  176. #include<bits/stdc++.h>
  177. using namespace std;
  178. #define pi acos(-1.0)
  179. #define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
  180. #define ll long long
  181. #define pb push_back
  182. #define fi first
  183. #define se second
  184. #define in insert
  185. #define mp make_pair
  186. #define GCD(a,b) __gcd(a,b);
  187. #define endl "\n"
  188. #define FRU freopen("out.txt","w",stdout)
  189. #define FRO freopen("in.txt","r",stdin)
  190. #define INFLL 9223372036854775807
  191. #define debug 0
  192. #define MAXN   100001
  193. #define ar array
  194. const int mxN=2e5;
  195. const int MOD=1e9+7;
  196. bool sortbysec(const pair<int,int> &a,const pair<int,int> &b){return (a.second < b.second);}
  197. //Don't hesitate to ask me if you don't understand my code.......Happy coding,Tahmid...;
  198.  
  199. int main()
  200. {
  201.     fastio;
  202.     ll n,c1=0,i,c2=0;
  203.     cin>>n;
  204.     string s,win="Adham",lose="Sartaj";
  205.     for(i=0;i<n;i++)
  206.     {
  207.         cin>>s;
  208.         if(s==win)
  209.             c1++;
  210.         else
  211.             c2++;
  212.  
  213.     }
  214.     if(c1>c2)
  215.     {
  216.         cout<<win<<endl;
  217.     }
  218.     else if(c1<c2)
  219.     {
  220.         cout<<lose<<endl;
  221.     }
  222.     else
  223.         cout<<"No imposter"<<endl;
  224.  
  225. }
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement