You are not logged in. Please login at www.codechef.com to post your questions!

×

GSRM01A - Editorial

PROBLEM LINK:

https://www.codechef.com/problems/GSRM01A

Author: Omkar Prabhu
Tester: Omkar Prabhu
Editorialist: Omkar Prabhu

DIFFICULTY:

EASY

PROBLEM:

You have to find if in-order sum(starting from index 1 to N) at any moment, is greater than or equal to K or not.

EXPLANATION:

Given an array A[N] and K, start your sum from A[1] till A[N].
If sum exceeds or is equal to K, print YES.
If sum after adding all elements or while adding each never exceeds or is equal to K, print NO.

AUTHOR'S AND TESTER'S SOLUTIONS:

Solution: http://ideone.com/hw0agC

This question is marked "community wiki".

asked 13 Oct '16, 21:24

nerdyninja's gravatar image

2★nerdyninja
7
accept rate: 0%

edited 04 Jan '17, 14:35

admin's gravatar image

0★admin ♦♦
19.8k350498541


include<stdio.h>

include<conio.h>

voidmain() { int a[n],k,i,sum=0; printf("enter elements"); scanf("%d",&a[i]); for(i=1;i<=n;i++) {sum=sum+a[i] } if(sum>=k) {printf("yes"); } else {printf("no); } getch(); }

link

answered 15 Oct '16, 21:46

dimple31's gravatar image

0★dimple31
1
accept rate: 0%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×15,852
×3,820
×968
×21

question asked: 13 Oct '16, 21:24

question was seen: 868 times

last updated: 04 Jan '17, 14:35