#include <bits/stdc++.h> using namespace std; int main() { int t,n,m,i,j,a[1000],b[1000],k,l,p; string s; //freo...
Read More
Home / lightoj
Showing posts with label lightoj. Show all posts
Showing posts with label lightoj. Show all posts
LightOj 1043 Triangle Partitioning
Hints: ADE/ABC=DE^2/BC^2 and AD/AB=DE/BC #include <bits/stdc++.h> using namespace std; int main() { int t,i,j; flo...
Read More
LightOj 1116 Ekka Dokka
#include <bits/stdc++.h> using namespace std; int main() { long long int l,m,t,w,y,z,h,x,p,q,n; //freopen("input...
Read More
LightOj 1109 - False Ordering
#include <bits/stdc++.h> using namespace std; #define n 1000005 bool a[n]; long long int k=1; long long int twin[n],i,j,t; bool...
Read More
LightOj 1189 Sum of Factorials
Hints: The highest number n is 10^18 . So highest factorial is 20! . So at first pre calculate factorials from 0 to 20. Then check fro...
Read More
LightOj 1024 EID
N:B :- Use Garbage Collector System.gc() after print to clear garbages and reduce memory size . import java.math.*; import java.util...
Read More
LightOj 1179 Josephus Problem
Tutorial : Josephus Problem #include <bits/stdc++.h> using namespace std; int lastman(int n,int k) { if(n==1) {...
Read More
LightOj 1042 Secret Origins
#include <bits/stdc++.h> using namespace std; int main() { long long int i,j,k,l,n,m,a[100000],d,b[100000],sum; ...
Read More
LightOj 1414 February 29
#include <bits/stdc++.h> using namespace std; int main() { long long int d1,d2,y1,y2,i,j,k,l,n,t,x,y,z,u,w; strin...
Read More
LightOj 1009 Back to Underworld
Hints : Bipartite Approach. Just use two colors to mark Vampires and Lycans. Then find who are maximum . As graph may be disconnected...
Read More
LightOj 1045 Digits Of Factorial
Number Of Factorial Digits = log(n!)+1 . As n is very large for factorial so we can write as below log(5!)=log(5*4*3*2*1)=log1+log2+lo...
Read More
LightOJ 1197 Help Hanzo
Hints : Implement, Segmented Sieve Algorithm To Generate Prime Numbers. Here is a tutorial for segmented sieve. Bangla Tutorial ...
Read More
LightOj 1354 IP Checking
#include <bits/stdc++.h> using namespace std; long long int decimal(long long int x) { long long int sum=0,r,k=0; ...
Read More
LightOJ 1107 How Cow
#include <bits/stdc++.h> using namespace std; int main() { long long int x1,y1,x2,y2,t,a,b,i,j,m; cin>>t; ...
Read More
LightOj 1053 Higher Math
#include <bits/stdc++.h> using namespace std; int main() { long long int t,a,b,c,m,n,i,j,p,q,r; vector<long long...
Read More
LightOJ 1214 Large Division
Find Tutorial Here: Big Integer Remainder #include <bits/stdc++.h> using namespace std; int main() { string s; ...
Read More
LightOj 1028 Trailing With Zeroes (I)
At First Check Out This Tutorial on Finding Number Of Divisors #include <bits/stdc++.h> using namespace std; #define ...
Read More
LightOj 1078 Integer Divisibility
Hints: long long int can not contain such a big type of data as there may be 10^6 digit. string or char data type can contain bu...
Read More
LightOj 1212 Double Ended Queue
#include <bits/stdc++.h> using namespace std; int main() { deque<int>dq; int t,n,m,i,j,p,r,c; string s...
Read More
LightOj-1069 Lift
#include <stdio.h> int main() { int t,a,b,e,o,i,f,r,g,s,d; scanf("%d",&t); for(i=1;i<=t;i++) { ...
Read More
Subscribe to:
Posts
(
Atom
)