lightoj-dev / problem-tutorials Goto Github PK
View Code? Open in Web Editor NEWA repository to contain tutorials for LightOJ problems
License: Creative Commons Zero v1.0 Universal
A repository to contain tutorials for LightOJ problems
License: Creative Commons Zero v1.0 Universal
Fix spacing, punctuations and spelling.
Work in progress...
Link: http://lightoj.com/volume_showproblem.php?problem=1387
I will soon create the pull request.
Problem link: http://lightoj.com/volume_showproblem.php?problem=1047
You have given a number n
. If n
can be written as addition of two positive integers such as, n = a+b
then print the value of a
and b
. Any value of a
and b
that follow the equation is accepted.
#include <stdio.h>
int main()
{
int test, num;
scanf("%d", &test);
while(test--){
scanf("%d", &num);
if(num > 10){
printf("%d ", 10);
num = num - 10;
}
else printf("0 ");
printf("%d\n", num);
}
return 0;
}
I will soon provide the english tutorial for the problem on trie "Consistency Checker" problem tag 1129
I want to start working on tutorial for this specific problem.
Problem: You are given what floor you are on and what floor the lift is on. You need to calculate how many seconds you will need to get to ground floor.
Assume that it takes 4 seconds for the lift to go from any floor to its adjacent floor (up or down). It takes 3 seconds to open or close the door of the lift and you need 5 seconds to enter or exit the lift.
That means you need to calculate the total time, T = time needed by the lift to come to your floor + time needed by the lift door to open + time needed by you to enter the lift + time needed by the lift door to close + time needed by the lift to reach ground floor + time needed by the lift door to open again + time needed by you to exit the lift.
Here,
time needed by the lift to come to your floor = abs(myPosition-liftPosition) * 4sec
time needed by the lift door to open = 3sec
time needed by you to enter the lift = 5sec
time needed by lift door to close = 3sec
time needed by the lift to reach ground floor = myPosition * 4sec
time needed by the lift door to open again = 3sec
time needed by you to exit the lift = 5sec
#include<bits/stdc++.h>
using namespace std;
int main(){
int testcase;
cin>>testcase;
for(int t=1; t<=testcase; t++){
int myPosition, liftPosition;
cin>>myPosition>>liftPosition;
int timeTakenByMeToEnter=5;
int timeTakenByMeToExit=5;
int timeTakenByLiftToOpen=3;
int timeTakenByLiftToClose=3;
int timeTakenByLiftToReachMyFloor= abs(myPosition-liftPosition)*4; // If lift was on floor 8 and I was on floor 2, (2-8)=-6. To avoid the minus sign, we used the abs() function. As lift takes 4 seconds to reach the adjacent floor, we multiply by 4.
int timeTakenByLiftToReachGroundFloorFromMyFloor=(myPosition)*4; //Lift takes 4 seconds to go from one floor to the next floor. That's why we multiply by 4.
cout<<"Case "<<t<<": "<< abs(myPosition-liftPosition)*4 + timeTakenByLiftToOpen + timeTakenByMeToEnter + timeTakenByLiftToClose + (myPosition)*4 + timeTakenByLiftToOpen + timeTakenByMeToExit<<endl;
}
}
Happy Coding!
will try to add english tutorial for http://lightoj.com/volume_showproblem.php?problem=1136 ASAP
Chess board knights only travel in L shaped squares.
In this problem there are 3 cases mainly considerable.
Case 1: If any of the rows or columns is 1 then there is no L shaped formed. So answer is max of row and column.See the pic for better understanding.
Case 2: If rows and columns are greater then 2 then just half the total of squares is the answer.
Case 3:(most important case) If either of the row or column is 2 then we just divide the total squares by 8 where 1st 4 blocks can be placed by knights and other 4 blocks are forbidden. See the pic for better understanding.
The remaining blocks(if any) if less then or equals 4 then remaining blocks are added to the answer and if greater then we add 4 to the answer.
int n,m;
cin>>n>>m;
if(m==1 or n==1)
{
cout<<"Case "<<i<<": "<<max(n,m)<<endl;
}
else if(n==2 or m==2)
{
cout<<"Case "<<i<<": "<<((m*n)/8)*4 + (((m*n)%8)>=4?4:(m*n)%8)<<endl;
}
else
{
cout<<"Case "<<i<<": "<<(n*m+1)/2<<endl;
}
Link: http://lightoj.com/volume_showproblem.php?problem=1338
I will soon create the pull request for the English tutorial.
I will try to complete the tutorial by the next week (16 Dec 2020)
I am yet to figure out how to assign myself for the issue.
The main problem with the website said that the user couldn't print duplicate numbers. But there haven't any also for merging the same number
Tutorial for Problem: http://www.lightoj.com/volume_showproblem.php?problem=1062
Creating PR now.
Link: http://lightoj.com/volume_showproblem.php?problem=1225
I will soon create the pull request.
1258/en.md
Should be resolved in a day or two :)
I want to start working on tutorial for this specific problem.
Link: http://lightoj.com/volume_showproblem.php?problem=1053
I will soon create the pull request.
Link: http://lightoj.com/volume_showproblem.php?problem=1182
I will soon create the pull request.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.