Codeforces 101775C - Traffic Light Solution

   Solution in C++: 

///******Bismillahir-Rahmanir-Rahim******///

///AH Tonmoy

///Department of CSE,23rd batch

///Islamic University,Bangladesh 

  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.  
  6. int t,k,i;
  7. cin>>t;
  8. for(k=1; k<=t; k++)
  9. {
  10. int n;
  11. double a,s=0;
  12. cin>>n;
  13. for(i=0; i<=n; i++)
  14. {
  15. cin>>a;
  16. s+=a;
  17. }
  18. double g,r,temp=0;
  19. for(i=1; i<=n; i++)
  20. {
  21. cin>>g>>r;
  22. temp=max(temp,r);
  23. }
  24. printf("Case #%d: %.10f\n",k,s+temp);
  25. }
  26. }

No comments

Most View Post

Recent post

RESTful APIs with CRUD Operations in Laravel 12| (2025)

  RESTful APIs serve as the foundation of modern web development. They follow a set of rules called Representational State Transfer (REST) t...

Powered by Blogger.