Codeforces Round #822 (Div. 2) 1734B - Bright, Nice, Brilliant Solution


 

Problem Link: https://codeforces.com/problemset/problem/1734/B

Solution in C++:

  1. /// La ilaha illellahu muhammadur rasulullah
  2. ///******Bismillahir-Rahmanir-Rahim******///
  3. /// Abul Hasnat Tonmoy
  4. /// Department of CSE,23rd batch
  5. /// Islamic University,Bangladesh
  6. ///**********ALLAH IS ALMIGHTY************///
  7. #include <bits/stdc++.h>
  8. using namespace std;
  9. int main() {
  10. int n, i, j, t;
  11. cin >> t;
  12. while (t--) {
  13. cin >> n;
  14. for (int i = 1; i <= n; i++) {
  15. for (int j = 1; j <= i; j++) {
  16. if (j == 1 || j == i)
  17. cout << "1 ";
  18. else
  19. cout << "0 ";
  20. }
  21. }
  22. cout << endl;
  23. }
  24. }

No comments

Most View Post

Recent post

Codeforces Round 971 (Div. 4) 2009C. The Legend of Freya the Frog Solution

  Problem Link    https://codeforces.com/contest/2009/problem/C S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. h &g...

Powered by Blogger.