Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Sum Is Everywhere Problem Code: SUMEVOD
Add problem to Todo list

You are given a number N and find the sum of the first N odd and even numbers in a line separated by space. All even and odd numbers should be greater than 0.

Input:
First-line will contain the number N.
Output:
Print the sum of the first N odd and even numbers in a line separated by space.

Constraints
1≤N≤106
Sample Input 1:
4
Sample Output 1:
16 20
Sample Input 2:
1
Sample Output 2:
1 2
EXPLANATION:
In the first example, (1 + 3 + 5 + 7) = 16 and (2 + 4 + 6 + 8) = 20.
In the second example, only one odd that is 1 and only one even that is 2.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <iostream>
#define ll long long
using namespace std;

int main() {
// your code goes here
ll n,even,odd;

cin>>n;
even = n(n+1);
odd = nn;
cout<<odd<<" "<<even;

return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Triangle With Angle Problem Code: ANGTRICH
Add problem to Todo list

You're given the three angles a, b, and c respectively. Now check if these three angles can form a valid triangle with an area greater than 0 or not. Print "YES"(without quotes) if it can form a valid triangle with an area greater than 0, otherwise print "NO" (without quotes).

Input:
First-line will contain three numbers a, b, and c separated by space.
Output:
Print "YES"(without quotes) if these sides can form a valid triangle, otherwise print "NO" (without quotes).

Constraints
0≤a,b,c≤180
Sample Input 1:
20 40 120
Sample Output 1:
YES
Sample Input 2:
100 18 42
Sample Output 2:
NO
EXPLANATION:
In the first example, angles set (20, 40, 120) can form a triangle with an area greater than 0.
In the second example, angles set (100, 18, 42) will never form a valid triangle.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <iostream>
using namespace std;

int main() {

int a,b,c;
cin>>a>>b>>c;
if(a+b+c==180&& a>0 && b>0 && c>0){
cout<<"YES";
}
else{
cout<<"NO";
}
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
You're given the length of three sides a, b, and c respectively. Now check if these three sides can form a triangle or not. Print "YES"(without quotes) if it can form a valid triangle with an area greater than 0, otherwise print "NO" (without quotes).

Input:
First-line will contain three numbers a, b, and c separated by space.
Output:
Print "YES"(without quotes) if these sides can form a valid triangle, otherwise print "NO" (without quotes).

Constraints
1≤a,b,c≤106
Sample Input 1:
2 4 3
Sample Output 1:
YES
Sample Input 2:
1 1 4
Sample Output 2:
NO
EXPLANATION:
In the first example, (2, 4, 3) can form a triangle with an area greater than 0.
In the second example, (1, 1, 4) will never form a valid triangle.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <iostream>
using namespace std;

int main()
{
int a, b, c;
cin >> a >> b >> c;
if (a + b < c a + c < b b + c < a)
cout << "NO";
else
cout << "YES";
return 0;
}