Mohamed_Saad62's blog

By Mohamed_Saad62, history, 2 years ago, In English

How to find number of values x which achieve GCD(n, x) = 1
n is constant
x <= m
m can be bigger than n
the related problem to this question that I am trying to solve:

https://codeforces.net/contest/1750/problem/D

Full text and comments »

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

By Mohamed_Saad62, history, 4 years ago, In English

If I have a Program.exe that takes input and print it.
If I want to run this program from the cmd I will go to its directory and write Program.exe (enter).
And what is going to happen a new line and waiting for the input.
But what if I want to give the input at the same line like that :

c:\Users\abc> Program.exe input
and that's it the program doesn't ask for input(as I gave it at the same line when I invoked the program) and print the output and terminate

I am working with c++.

Full text and comments »

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

By Mohamed_Saad62, history, 4 years ago, In English

AT this problem https://codeforces.net/gym/102470/problem/A (short statment below)
after three days of coding to avoid runtime error I get TLE on a binary search solution can someone explain what is wrong with my solution

the short statement : You are given set of points (x,y) find point on (y = 0) which all point can go to this point in minimum time and all have the same speed which is one meter per second

my code : https://codeforces.net/contest/1445/submission/98270485 (the code has comments :)

Full text and comments »

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

By Mohamed_Saad62, history, 4 years ago, In English

I really want to know how to solve this problem :

You are given two positive integers d and s. Find minimal positive integer n which is divisible by d and has sum of digits equal to s.

the link : https://codeforces.net/contest/1070/problem/A

Full text and comments »

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

By Mohamed_Saad62, history, 4 years ago, In English

If I am calling too many functions which is more than allowed in the memory limit I will get run time error or memory limit exceeded ? like in this code https://codeforces.net/contest/1067/submission/85187079

UPD If I am calling too many functions which is more than the stack size I will get run time error or memory limit exceeded ?

Full text and comments »

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

By Mohamed_Saad62, history, 4 years ago, In English

Can someone provide a tutorial on how to use prefix sum with dynamic programming ?

Full text and comments »

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

By Mohamed_Saad62, history, 5 years ago, In English

Given a string consist just of the letter 'u' ,if we can consider every two adjacent 'u' -->' w' and every u can be used only once in how many ways the string can appear ?

example : uuu can be uuu or wu or u w so the answer is 3 .

I am asking this question because at the last contest I was trying to solve this problem https://codeforces.net/contest/1245/problem/C and I claim the solution is every continuous 'u' or 'n' I save in how many ways it can appear in a vector and then multiply all the numbers and this is the answer .

Full text and comments »

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