Good Bye 2023 1916A - 2023 Solution


  

Problem Link : https://codeforces.com/contest/1916/problem/A

Solution in C++:

  1. /// Author : AH_Tonmoy
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4. int32_t main() {
  5. ios_base::sync_with_stdio(0);
  6. cin.tie(0);
  7. int t;
  8. cin >> t;
  9. while (t--) {
  10. int n , k ; cin >> n >> k;
  11. int a ;
  12. long long x = 1 ;
  13. for ( int i = 0 ; i < n ; i++){
  14. cin >> a ;
  15. x *= a ;
  16. }
  17. if ( 2023 % x !=0){
  18. cout <<"No\n" ;
  19. }
  20. else{
  21. cout <<"YES\n";
  22. cout << 2023/x <<" ";
  23. for (int i = 1 ; i < k ; i++){
  24. cout <<"1 ";
  25. }
  26. cout <<endl;
  27. }
  28. }
  29. return 0 ;
  30. }

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 ...

Powered by Blogger.