Advertisement
Mizuhara_Chizuru

Coding Ninja Surya's Answers Lecture 4

Dec 28th, 2021
33
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<iostream>
  2. using namespace std;
  3.  
  4.  
  5. int main(){
  6.  
  7. /* Read input as specified in the question.
  8. * Print output as specified in the question.
  9. */
  10. int n;
  11. cin>>n;
  12. for(int i=0;i<n;i++)
  13. {
  14. for(int j=0;j<n;j++)
  15. cout<<n;
  16. cout<<'\n';
  17. }
  18. }
  19.  
  20. #include<iostream>
  21. using namespace std;
  22.  
  23.  
  24. int main(){
  25.  
  26. /* Read input as specified in the question.
  27. * Print output as specified in the question.
  28. */
  29. int n;
  30. cin>>n;
  31. for(int i=0;i<n;i++)
  32. {
  33. for(int j=0;j<=i;j++)
  34. cout<<'*';
  35. cout<<'\n';
  36. }
  37. }
  38.  
  39.  
  40.  
  41. #include<iostream>
  42. using namespace std;
  43.  
  44.  
  45. int main(){
  46.  
  47. /* Read input as specified in the question.
  48. * Print output as specified in the question.
  49. */
  50. int n;
  51. cin>>n;
  52. for(int i=1;i<=n;i++)
  53. {
  54. for(int j=0;j<i;j++)
  55. cout<<i;
  56. cout<<'\n';
  57. }
  58. }
  59.  
  60. #include<iostream>
  61. using namespace std;
  62.  
  63.  
  64. int main(){
  65.  
  66. /* Read input as specified in the question.
  67. * Print output as specified in the question.
  68. */
  69. int n;
  70. cin>>n;
  71. for(int i=1;i<=n;i++)
  72. {
  73. for(int j=i;j>0;j--)
  74. cout<<j;
  75. cout<<'\n';
  76. }
  77. }
  78.  
  79.  
  80. #include<iostream>
  81. using namespace std;
  82.  
  83.  
  84. int main(){
  85.  
  86. /* Read input as specified in the question.
  87. * Print output as specified in the question.
  88. */
  89. int n;
  90. cin>>n;
  91. for(int i=1;i<=n;i++)
  92. {
  93. for(int j=1;j<=i;j++)
  94. cout<<char(64+i);
  95. cout<<'\n';
  96. }
  97. }
  98.  
  99. /*Code by Surya a.k.a Sunny*/
  100. /* by https://www.codechef.com/users/spsc */
  101. #include <bits/stdc++.h>
  102. //#include <boost/multiprecision/cpp_int.hpp>
  103. #define lli long long
  104. #define pi 3.14159265358979323846
  105. #define MOD 1000000007
  106. #define unbuffer cin.clear(); cin.sync();
  107. #define foi(n) for(lli i=0;i<n;i++)
  108. #define foj(n) for(lli j=0;j<n;j++)
  109. #define test(T) lli T;cin>>T;while(T--)
  110. #define loop(i, a, b) for(int i = (a); i<= (b); i++)
  111. using namespace std;
  112. //using namespace boost::multiprecision;
  113. int main()
  114. {
  115. lli n,temp=1;
  116. cin>>n;
  117. for(int i=1;i<=n;i++)
  118. {
  119. temp=i;
  120. for(int j=1;j<=i;j++)
  121. {
  122. cout<<char(64+temp);
  123. temp++;
  124. }
  125. cout<<'\n';
  126. }
  127. }
  128.  
  129. /*Code by Surya a.k.a Sunny*/
  130. /* by https://www.codechef.com/users/spsc */
  131. #include <bits/stdc++.h>
  132. //#include <boost/multiprecision/cpp_int.hpp>
  133. #define lli long long
  134. #define pi 3.14159265358979323846
  135. #define MOD 1000000007
  136. #define unbuffer cin.clear(); cin.sync();
  137. #define foi(n) for(lli i=0;i<n;i++)
  138. #define foj(n) for(lli j=0;j<n;j++)
  139. #define test(T) lli T;cin>>T;while(T--)
  140. #define loop(i, a, b) for(int i = (a); i<= (b); i++)
  141. using namespace std;
  142. //using namespace boost::multiprecision;
  143. int main()
  144. {
  145. lli n,temp=1;
  146. cin>>n;
  147. for(int i=n;i>0;i--)
  148. {
  149. temp=i;
  150. for(int j=i;j<=n;j++)
  151. {
  152. cout<<char(64+temp);
  153. temp++;
  154. }
  155. cout<<'\n';
  156. }
  157. }
  158.  
Advertisement
RAW Paste Data Copied
Advertisement