pop1912's blog

By pop1912, history, 3 months ago, In English

Hi, I'm using "cin.ignore()" to ignore the input. I want only the 2nd integer to be displayed for this sample Input, I'm getting WA for some Test Cases, What is wrong in my code?:

Testcase 1:(Output should be "1")

2 1
carrots?
bunnies

Testcase 2:(Output should be "5")

1 5
sovl problmz

My Code:

#include<iostream>
using namespace std;

int main() {
    int a;
    cin.ignore();
    cin>>a;
    cin.ignore();
    
    cout<<a;
    
    return 0;
}

Read more »

 
 
 
 
  • Vote: I like it
  • -22
  • Vote: I do not like it

By pop1912, history, 3 months ago, In English

Hi, Can you help me in this CSES Two Sets problem?.

Statement:

Your task is to divide the numbers 1,2,…,n into two sets of equal sum.

Input

The only input line contains an integer n.

Output

Print "YES", if the division is possible, and "NO" otherwise.

After this, if the division is possible, print an example of how to create the sets. First, print the number of elements in the first set followed by the elements themselves in a separate line, and then, print the second set in a similar way.

Constraints 1≤n≤106

Read more »

 
 
 
 
  • Vote: I like it
  • 0
  • Vote: I do not like it

By pop1912, history, 4 months ago, In English

Hi, Could you help me in this problem. "https://codeforces.com/problemsets/acmsguru/problem/99999/100".

My solution is my-submission. I'm getting WA, help me identify the mistake.

#include<iostream>
#include<fstream>
using namespace std;

int  main() {
    ifstream fin("input.in");
    ofstream fout("output.out");
    
    int a,b;
    fin>>a>>b;
    
    fout<<a + b<<"\n";
    
    return 0;
}

Thanks, pop1912

Read more »

 
 
 
 
  • Vote: I like it
  • +5
  • Vote: I do not like it

By pop1912, history, 4 months ago, In English

I have mistakenly used this user name, now I want to change to other but I can't see that option in the settings, Please help me...

Read more »

 
 
 
 
  • Vote: I like it
  • -20
  • Vote: I do not like it