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

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.