1.
1000 - Greetings from LightOJ
Add a and b then print the result.
2.
1001 - Opposite Task
If n is less then 10 then print 0 and n. Else print n-10 and 10.
3.
1006 - Hex-a-bonacci
Do memorization or build tabulation form.
4.
1008 - Fibsieve`s Fantabulous Birthday
There is a pattern. We have to find the odd and even square number and the mid point of two square number. Then follow the pattern.
5.
1010 - Knights in Chessboard
Maximum number of knights that can be placed in the board considering the restrictions by giving place all knights either in white or in black squares.
That's mean Knm = ½ * n * m [ if n*m is even] or Knm = (½ * n * m) + 1 [if n*m is odd].
There is some special case for n = 1 or m = 1 and n = 2 or m = 2.
6.
1015 - Brush (I)
Print the summation of nonzero positive integers.
7.
1022 - Circle in Square
Find (Area of square - Area of Circle).
8.
1042 - Secret Origins
See this
9.
1045 - Digits of Factorial
Find digit of factorials by f[i] = log(i) + f[i-1], where i = 1 to 1000000, then answer will be floor(f[n]/log(base)) + 1.
10.
1053 - Higher Math
Apply a2 + b2 = c2 [Pythagoras Theorem]
11.
1069 - Lift
Check between your position and lift's position then calculate the time.
12.
1072 - Calm Down
There is a large circle with radius R and n little circles each having radius r, are placed inside on the border of the large circle.
then, r = (R * sin(angle)) / (1+sin(angle)) where, angle = PI / n.
There is a large circle with radius R and n little circles each having radius r, are placed outside on the border of the large circle.
then, r = (R * sin(angle)) / (1-sin(angle)) where, angle = PI / n.
13.
1107 - How Cow
Determine if x is in the range of [x1,x2] and y is in the range of [y1,y2].
14.
1109 - False Ordering
First find the divisors of each number 1 to 1000, then place them in an array according to the condition. We have to pre-calculate the whole process. To do it a thing we have to keep in mind that no number will have more than √(1000) = 32 divisors.
15.
1113 - Discover the Web
We will use concept of stack in this problem. Take two stacks (use STL) and do whatever is said in the problem.
16.
1116 - Ekka Dokka
We have to find a number x such that W%(2x)==0 and N = (W / x) should be odd. x should be in 1 to 63.
17.
1133 - Array Simulation
Do the operations using simple for loops.
18.
1136 - Division by 3
Let, a positive number sequence is -
1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17...
Now digit sum from 1 to N is (N*(N+1))/2.
for N = 1, digit sum = 1 % 3 = 1 (Not the result)
N = 2, " = 3 % 3 = 0
N = 3, " = 6 % 3 = 0
N = 4, " = 10%3 = 1 (Not the result)
.
.
.
Now, you will get a sequence where you can get a result.
19.
1182 - Parity
Use __builtin_popcount(n)function.
20.
1189 - Sum of Factorials
First pre-calculate Sum of factorials - sum[i] = sum[i-1] + fact[i], where i is 1 to 20.
Then you can't get the result (or impossible) if (sum[pos] < n && fact[pos+1] > n)here pos is the position where (f[i]<=n). Now just print the result.
21.
1202 - Bishops
We have to think about 2 cases.
1211 - Intersection of Cubes
[Removed from beginner category in New LOJ version.]
23.
1212 - Double Ended Queue
Use STL
24.
1214 - Large Division
In JAVA you can easily solve this by BigInteger. In C/C++ use string to solve this problem.
25.
1216 - Juice in the Glass
Now, there is a angle, so, we can write-
1000 - Greetings from LightOJ
Add a and b then print the result.
2.
1001 - Opposite Task
If n is less then 10 then print 0 and n. Else print n-10 and 10.
3.
1006 - Hex-a-bonacci
Do memorization or build tabulation form.
4.
1008 - Fibsieve`s Fantabulous Birthday
There is a pattern. We have to find the odd and even square number and the mid point of two square number. Then follow the pattern.
5.
1010 - Knights in Chessboard
Maximum number of knights that can be placed in the board considering the restrictions by giving place all knights either in white or in black squares.
That's mean Knm = ½ * n * m [ if n*m is even] or Knm = (½ * n * m) + 1 [if n*m is odd].
There is some special case for n = 1 or m = 1 and n = 2 or m = 2.
6.
1015 - Brush (I)
Print the summation of nonzero positive integers.
7.
1022 - Circle in Square
Find (Area of square - Area of Circle).
8.
1042 - Secret Origins
See this
9.
1045 - Digits of Factorial
Find digit of factorials by f[i] = log(i) + f[i-1], where i = 1 to 1000000, then answer will be floor(f[n]/log(base)) + 1.
10.
1053 - Higher Math
Apply a2 + b2 = c2 [Pythagoras Theorem]
11.
1069 - Lift
Check between your position and lift's position then calculate the time.
12.
1072 - Calm Down
There is a large circle with radius R and n little circles each having radius r, are placed inside on the border of the large circle.
then, r = (R * sin(angle)) / (1+sin(angle)) where, angle = PI / n.
There is a large circle with radius R and n little circles each having radius r, are placed outside on the border of the large circle.
then, r = (R * sin(angle)) / (1-sin(angle)) where, angle = PI / n.
13.
1107 - How Cow
Determine if x is in the range of [x1,x2] and y is in the range of [y1,y2].
14.
1109 - False Ordering
First find the divisors of each number 1 to 1000, then place them in an array according to the condition. We have to pre-calculate the whole process. To do it a thing we have to keep in mind that no number will have more than √(1000) = 32 divisors.
15.
1113 - Discover the Web
We will use concept of stack in this problem. Take two stacks (use STL) and do whatever is said in the problem.
16.
1116 - Ekka Dokka
We have to find a number x such that W%(2x)==0 and N = (W / x) should be odd. x should be in 1 to 63.
17.
1133 - Array Simulation
Do the operations using simple for loops.
18.
1136 - Division by 3
Let, a positive number sequence is -
1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17...
Now digit sum from 1 to N is (N*(N+1))/2.
for N = 1, digit sum = 1 % 3 = 1 (Not the result)
N = 2, " = 3 % 3 = 0
N = 3, " = 6 % 3 = 0
N = 4, " = 10%3 = 1 (Not the result)
.
.
.
Now, you will get a sequence where you can get a result.
19.
1182 - Parity
Use __builtin_popcount(n)function.
20.
1189 - Sum of Factorials
First pre-calculate Sum of factorials - sum[i] = sum[i-1] + fact[i], where i is 1 to 20.
Then you can't get the result (or impossible) if (sum[pos] < n && fact[pos+1] > n)here pos is the position where (f[i]<=n). Now just print the result.
21.
1202 - Bishops
We have to think about 2 cases.
- If there is a bishop in black cell and another one is in white cell the we can never take one bishop to other.
- If both are in same color cells then we have to check whether they are in diagonally same position or not. If they are in diagonally same position then the result will be 1 otherwise 2.
1211 - Intersection of Cubes
[Removed from beginner category in New LOJ version.]
23.
1212 - Double Ended Queue
Use STL
deque<int>Q
. 24.
1214 - Large Division
In JAVA you can easily solve this by BigInteger. In C/C++ use string to solve this problem.
25.
1216 - Juice in the Glass
Now, there is a angle, so, we can write-
r1/(h+x) = r2/x
so, x = (hr2)/(r1-r2)
again, r/(p+x) = r2/x
[putting the value of x]
so, r = ((p(r1-r2))/h) + r2
26.
1225 - Palindromic Numbers (II)
Check the string from the end with the beginning. If it is not same then print No.
27.
1227 - Boiled Eggs
No hints.
28.
1241 - Pinocchio
First we will take a = 2 then we will check each value with a. If (a != value) then cnt+=(ceil((value-a)/5))and set a = value.
29.
1249 - Chocolate Thief
so, x = (hr2)/(r1-r2)
again, r/(p+x) = r2/x
[putting the value of x]
so, r = ((p(r1-r2))/h) + r2
thus, V = (PI * p * (r2 + r22 + (r*r2)))/3
26.
1225 - Palindromic Numbers (II)
Check the string from the end with the beginning. If it is not same then print No.
27.
1227 - Boiled Eggs
No hints.
28.
1241 - Pinocchio
First we will take a = 2 then we will check each value with a. If (a != value) then cnt+=(ceil((value-a)/5))and set a = value.
29.
1249 - Chocolate Thief
Each student will have exactly (total volume / n) volume chocolate. Now we will check which student has extra and which student has less than this value.
30.
Isn't it (n * m) / 2 ?? Try yourself... :p
31.
Lets, O is the intersection point of AC & BD and it is also the mid point of AC & BD. So,
(Ax + Cx) / 2 = (Bx + Dx) / 2
or, Dx = Ax + Cx - Bx
similarly, Dy = Ay + Cy - By
Now, Using Shoelace Formula we can easily get the area.
32.
Do you know the formula v2 = u2 + 2as and a = (v / t)? Then this is an easy physics question...just solve it.
33.
Use Law of cosines.
34.
Use a count array or map to count the occurrence of letters.
35.
Convert decimal values in binary and check if they are equal or not. Read this to know more.
36.
If you know how to check if a year is leap year or not then it is an easy problem for you.
37.
No hints.
38.
Just implement this formula in code.
The End
No comments:
Post a Comment