• Sign Up
• Login
• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

a guest Dec 3rd, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. Talking about whom didn’t solve anything
2. Posts must be read — feedback only 5 6 people — contest notes, found same problem
3. Read the statement carefully
4. Solve previous contest:
5.
6. A: native solution(while), better -> if (n%5 == 0) print(n/5) : print(n/5+1)
7.
8. B: while(a<b) a*3, b*2
9. a*3^n > b*2^n
10.     (3/2)^n > (b/a)
11.     n > log1.5(b/a)
12.     floor(
13.
14. C:
15. Note that the formula n(n+1)/2 is used only for adding n consecutive integers starting from 1.
16. A problem may not directly ask you for this but if you can break it down such that you have to find the sum of 'n consecutive integers starting from 1' then you can use this formula.
17.
18. In the even integers questions, you may be required to find the sum of first 10 even integers.
19. 2 + 4 + 6 + ... + 18 + 20
20. Take 2 common, 2*(1 + 2 + 3 + ...10)
21. To find the sum of the highlighted part, we can use the formula. Then we can multiply it by 2 to get the required sum.
22.
23. Note that for odd integers, you cannot directly use this formula.
24. Sum the first 10 odd integers
25. 1 + 3 + 5 + 7+...+19
26. But you can still make some modifications to find the sum.
27.
28. 1 + 3 + 5 + 7+...+19 = (1 +2+ 3 + 4+5 + 6+ 7+...+19 + 20) - (2 + 4+ 6+...20)
29. We know how to sum consecutive integers.
30. (1 +2+ 3 + 4+5 + 6+ 7+...+19 + 20) = 20*21/2
31. (2 + 4+ 6+...20) = 2 * (10*11)/2 = 10*11 (as before)
32.
33. So 1 + 3 + 5 + 7+...+19 = (20*21/2) - (10*11) = 100
34. ——————————————————————————————————————
35. D: while loop(scan 2 number) if q-p >=2, count++
36.
37. E: sum(Xs, Ys, Zs) if equal 0,0,0 print yes otherwise print no,
38. NOTE: YOU CAN’T SUM ALL OF THEM
39. -1 0 1
40. -1 0 1
41.
42. F: scan 3 integers and sum them, if sum>=2, count++
43.
44. G: initialise sum = 0, maxPass = 0, each scan do sum-a and sum+b, check if sum>maxPass, maxPass = sum
45.
46. H: n,h … scan n numbers, for each number check if it’s > h ans+=2, otherwise ans+=1
47.
48. J: read the problem with them, difference between lucky number and nearly lucky number, 10^18 -> long long
49. ——————————————————————————————————————
50.
51. Ask for any problems
52.
53. I: for loop will time limit .. n%2 == 0, print n/2 … otherwise print -(n+1)/2
54. Mention Reem’s solution, sum_even to n, sum_odd to n .. print sum_even+sum_odd
55.
56. Time complexity: 10^9 maximum
57. ——————————————————————————————————————
58. Arrays of integers:
59. How to write it
60. Practice 1: given list of numbers, print it from the last to the first
61. Practice 2: Reverse the array (let them solve it)
62.
63. Array of chars:
64. How to write it
65. Size of the array is equal to the limit of the problem
66. ‘\0’ is the termination character
67. strlen(), strcmp(), strcpy(), strcat(), tolower(), toupper()
68.
69. Practice 1: loop over string and print each character
70. Practice 2: print (first character, number of characters between first and last character, last character)
71. ——————————————————————————————————————
72. Contests Problems: (Still in progress)
73. https://codeforces.com/problemset/problem/281/A
74. https://codeforces.com/problemset/problem/71/A
75. https://codeforces.com/problemset/problem/118/A
76. https://codeforces.com/problemset/problem/112/A
77. https://codeforces.com/problemset/problem/96/A
78. Palindrome: https://codeforces.com/problemset/problem/798/A
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!

Top