Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(){
- int tc,x,left,right,max,boss;
- scanf("%d",&tc);
- for(int i=1;i<=tc;i++){
- left = 0, right = 0, max=-1000001;
- scanf("%d",&x);
- int map[x];
- for(int j=0;j<x;j++){
- scanf("%d",&map[j]);
- if(map[j]>max){
- max = map[j];
- boss = j;
- }
- }
- for(int j=1;j<boss;j++){
- if(map[j-1]<map[j] && map[j+1]<map[j]){
- left+=map[j];
- }
- }
- for(int j=x-2;j>boss;j--){
- if(map[j-1]<map[j] && map[j+1]<map[j]){
- right+=map[j];
- }
- }
- printf("Case #%d:",i);
- if(left==right){
- printf(" same\n");
- }else if(left<right){
- printf(" left\n");
- }else{
- printf(" right\n");
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement