This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
const unsigned int Sunday = 1; | |
unsigned int getWeekday(unsigned long long year, unsigned int month, unsigned int day) | |
{ | |
if (month <= 2) | |
{ | |
month += 12; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdbool.h> | |
#include <math.h> | |
#define N 100001 | |
int main(void){ | |
bool *sieve = (bool *)malloc(N * sizeof(bool)); | |
sieve[0] = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.math.BigInteger; | |
import java.util.Scanner; | |
public class Solution { | |
public static void main(String[] args) { | |
try (Scanner sc = new Scanner(System.in)) { | |
int t = sc.nextInt(); | |
for(int i = 0; i < t; i++) { | |
int n = sc.nextInt(); | |
BigInteger fact = BigInteger.valueOf(1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Solution { | |
public static void main(String[] args) { | |
Scanner sc = new Scanner(System.in); | |
int T = sc.nextInt(); | |
double goldenNumber = (1 + Math.sqrt(5)) / 2; | |
for(int i = 0; i < T; i++) { | |
int N = sc.nextInt(); | |
int g = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class Solution { | |
private static int[] ScoreData; | |
public static void main(String[] args) { | |
Scanner sc = new Scanner(System.in); | |
int N = sc.nextInt(); | |
String[] NData = new String[N]; | |
for(int i = 0; i < N; i++) { | |
NData[i] = sc.next(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Solution { | |
public static void main(String[] args) { | |
int[] mla = getmaxLengthArray(); | |
Scanner sc = new Scanner(System.in); | |
int T = sc.nextInt(); | |
for(int a0 = 0; a0 < T; a0++) { | |
int N = sc.nextInt(); | |
System.out.println(mla[N - 1]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <algorithm> | |
#include <unordered_set> | |
std::string num2str(unsigned int x, unsigned int digits) | |
{ | |
std::string result; | |
while (digits-- > 0) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string> | |
#include <iostream> | |
unsigned int getDigit(unsigned long long pos) | |
{ | |
unsigned int digits = 1; | |
unsigned long long range = 9; | |
unsigned long long first = 1; | |
unsigned long long skip = 0; | |
while (skip + digits*range < pos) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Solution { | |
public static void main(String[] args) { | |
try (Scanner sc = new Scanner(System.in)) { | |
int N = sc.nextInt(); | |
if(N < 0) { | |
N = N * -1; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
unsigned int powmod(unsigned long long base, unsigned int exponent, unsigned int modulo) { | |
unsigned long long result = 1; | |
while(exponent > 0) { | |
if(exponent % 2) { | |
result = (result * base) % modulo; | |
exponent--; | |
} else { | |
base = (base * base) % modulo; |