×

# GSRM01A - Editorial

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

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

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".

7
accept rate: 0%

19.8k350498541

# 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(); }

0★dimple31
1
accept rate: 0%

 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• 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