show that among any group of five (not necessary consecutive
) integers, there are two with the same remainder when
divided by 4.
Answer / lalala
generalized pigeon principle: If N objects are placed into k
boxes, then there is at least one box containing at least (ceiling) N/k objects.
let k = 4 ;
find N:
N/4 = 2 , N= 5, in order to get the answer 2..
| Is This Answer Correct ? | 17 Yes | 19 No |
let a,b,c be three integer numbers.write a c++ program with a function void rotate 1()such that a->b->c and c->a.
Do you need a main function in c++?
Name the operators that cannot be overloaded in C++?
What is long in c++?
Write a program to swap 2 chars without using a third varable? char *s = "A"; char *p = "B";
What is Namespace?
What is the use of typedef?
Design a program to input a date from user in the form day/month/year (e.g. 2/6/2000) and report whether it’s a valid date or not. The program should take account of leap years. You will need to know that a leap year is a year that is exactly divisible by 4, except that century years are only leap years if they are divisible by 400.
Out of fgets() and gets() which function is safe to use and why?
How do I tokenize a string in c++?
Explain how to initialize a const data member.
Is c# written in c++?