My issue
not able to solve problem
My code
#include <stdio.h>
int main(void) {
// your code goes here
int t;
scanf("%d",&t);
while(t--)
{
int
}
return 0;
}
Problem Link: WATSCORE Problem - CodeChef
not able to solve problem
#include <stdio.h>
int main(void) {
// your code goes here
int t;
scanf("%d",&t);
while(t--)
{
int
}
return 0;
}
Problem Link: WATSCORE Problem - CodeChef
@nikhilendra99
This is my c++ code .
I have implemented brute force logic .
Hope u will get it.
#include<bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while(t--){
int n;
cin >> n;
int problem[n];
int score[n];
for(int i =0; i <n; i++){
cin >> problem[i] >> score[i];
}
int totalScore = 0;
int maxScore = 0;
for(int i = 0 ; i <n; i++){
maxScore=score[i];
for(int j = i+1; j < n; j++){
if(problem[i] == problem[j] && problem[i] <= 8){
maxScore = max(maxScore, score[j]);
score[j]=0;
}
}
if(problem[i]<=8)
totalScore += maxScore;
}
cout << totalScore << endl;
}
return 0;
}