Skip to content
This repository was archived by the owner on Feb 29, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
e57d9ab
Add files via upload
javaarchive Jun 15, 2018
b20e7d6
Add files via upload
javaarchive Jun 24, 2018
d1ed7a1
Add files via upload
javaarchive Jun 24, 2018
69f3073
Add files via upload
javaarchive Jun 24, 2018
ba52039
Add files via upload
javaarchive Jun 24, 2018
c9846bc
Add files via upload
javaarchive Jun 24, 2018
4164694
Update README.md
javaarchive Jun 24, 2018
71945b1
Add files via upload
javaarchive Jul 9, 2018
88d6f53
Add files via upload
javaarchive Jul 22, 2018
0e90eaf
Add files via upload
javaarchive Sep 10, 2018
85a40a2
Kind of Merge branch 'master' into usacocode
javaarchive Sep 10, 2018
2fdbb90
Merge branch 'usacocode' of https://github.com/javaarchive/Java into …
javaarchive Sep 10, 2018
3f3b2e3
Add files via upload
javaarchive Sep 10, 2018
c4e97ca
Update README.md
javaarchive Sep 10, 2018
593ed06
Casework complete!!!!
javaarchive Sep 10, 2018
a7477d7
Add files via upload
javaarchive Oct 1, 2018
24b02c3
Add files via upload
javaarchive Oct 20, 2018
c0c7d18
Copy eclipse project
javaarchive Nov 5, 2018
c165941
Something...
javaarchive Dec 29, 2018
6161330
Some new stuff
javaarchive Jan 15, 2019
088e7ea
Added my other ignore file
javaarchive Jan 15, 2019
16d4991
Reverted to old loop stopping code
javaarchive Jan 15, 2019
8057f57
Removed my test line
javaarchive Jan 15, 2019
2d0cdd3
Large test case output version
javaarchive Jan 15, 2019
7c5a3a2
test case test for case 2 is off
javaarchive Jan 15, 2019
3db5a7c
Testing new calculations
javaarchive Jan 15, 2019
f095e67
New calculation failed
javaarchive Jan 15, 2019
464bfcb
Delete some code...............
javaarchive Jan 15, 2019
5065dbb
Quick edit
javaarchive Jan 15, 2019
bb99832
Added line empty or not logic
javaarchive Jan 15, 2019
430b23d
sort by senority
javaarchive Jan 15, 2019
b8ccaf0
Senority sort
javaarchive Jan 15, 2019
7d601ba
more code...
javaarchive Jan 15, 2019
1dfd4b4
Added more
javaarchive Jan 15, 2019
8e21161
Almost working code
javaarchive Jan 15, 2019
1b934a2
Started debugging
javaarchive Jan 15, 2019
36d0480
Rewrite
javaarchive Jan 15, 2019
7faac51
A WORKING VERSION
javaarchive Jan 15, 2019
a7198ed
Merge branch 'usacocode' of https://github.com/javaarchive/Java into …
javaarchive Jan 15, 2019
63df8b3
Add files via upload
javaarchive Apr 29, 2019
aae93bf
Add files via upload
javaarchive Apr 29, 2019
014816e
Add files via upload
javaarchive Apr 29, 2019
d0eef15
Add files via upload
javaarchive Jun 21, 2019
ac1d366
Add files via upload
javaarchive Jun 22, 2019
a88e159
Add Unmodified version from yesterday
javaarchive Jun 28, 2019
da5933e
Add files via upload
javaarchive Jun 28, 2019
164c572
Add files via upload
javaarchive Jun 28, 2019
ff21b5c
Upload NonWorking edition
javaarchive Jun 28, 2019
251210d
ReOptimize
javaarchive Jun 28, 2019
eb40298
Intersection method change
javaarchive Jun 28, 2019
a133fdd
Add files via upload
javaarchive Jun 28, 2019
95649e4
Fixing some things up
javaarchive Jun 28, 2019
2cdd677
Longing for longs
javaarchive Jun 28, 2019
05bf005
U-S-A-C-O
javaarchive Jun 28, 2019
a876b51
new code
javaarchive Jun 28, 2019
9ce8286
Add files via upload
javaarchive Jun 28, 2019
860e9e3
Working Solution
javaarchive Jun 29, 2019
24311f3
Update README.md
javaarchive Jan 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add files via upload
  • Loading branch information
javaarchive authored Apr 29, 2019
commit 63df8b3a0661ea4252a3d235ba5113d919329d26
Binary file not shown.
Binary file not shown.
Binary file not shown.
17 changes: 17 additions & 0 deletions javausaco - Copy/Codeforces!!!/src/Main1_Heist.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import java.util.*;
public class Main1_Heist {
public static void main(String[] args) {
ArrayList<Integer> a=new ArrayList<Integer>();
Scanner sc=new Scanner(System.in);
int n=Integer.parseInt(sc.nextLine());
for(int i=0;i<n;i++) {
a.add(sc.nextInt());
}
a.sort(null);
int s=0;
for(int i=0;i<(n-1);i++) {
s+=(a.get(i+1)-a.get(i)-1);
}
System.out.println(s);
}
}
20 changes: 20 additions & 0 deletions javausaco - Copy/Codeforces!!!/src/Main2_TV_Buying.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import java.util.Scanner;

public class Main2_TV_Buying {
public static long gcd(long a, long b)
{
if (b == 0)
return a;
return gcd(b, a % b);
}
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
long a=sc.nextLong();
long b=sc.nextLong();
long x=sc.nextLong();
long y=sc.nextLong();
long g=gcd(x,y);
System.out.println(Long.min((long) a/(x/g), (long) b/(y/g)));
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import java.util.Scanner;

public class Main3_Pythgorean_Triple_finder {
public static int div(long n) {
long t;
for(int i=0;i<500;i++) {
t=n/(long) (Math.pow((double) n,(double) i));
if((t&1)==0) {
return i;
}
}
return n;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
long a=sc.nextLong();
sc.close();
int even=1;
if((a & 1)==0) {
int r;
even=div(a);
r=a/(long) (Math.pow((double) a,(double) even))
}


}

}
20,990 changes: 20,990 additions & 0 deletions javausaco - Copy/Cryptography/M6972593.txt

Large diffs are not rendered by default.

Binary file not shown.
Binary file added javausaco - Copy/Cryptography/bin/RSA/Test1.class
Binary file not shown.
201 changes: 201 additions & 0 deletions javausaco - Copy/Cryptography/primes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@

100000000003
100000000019
100000000057
100000000063
100000000069
100000000073
100000000091
100000000103
100000000129
100000000171
100000000183
100000000193
100000000211
100000000223
100000000237
100000000253
100000000283
100000000319
100000000363
100000000367
100000000379
100000000393
100000000403
100000000411
100000000417
100000000427
100000000447
100000000487
100000000519
100000000567
100000000579
100000000621
100000000631
100000000637
100000000669
100000000699
100000000703
100000000721
100000000739
100000000747
100000000801
100000000817
100000000819
100000000861
100000000901
100000000943
100000000951
100000001009
100000001099
100000001111
100000001149
100000001201
100000001209
100000001237
100000001239
100000001249
100000001267
100000001287
100000001291
100000001317
100000001347
100000001363
100000001377
100000001389
100000001399
100000001467
100000001489
100000001509
100000001513
100000001551
100000001557
100000001567
100000001641
100000001659
100000001693
100000001729
100000001771
100000001807
100000001831
100000001837
100000001839
100000001863
100000001909
100000001921
100000001923
100000001939
100000001957
100000001989
100000002017
100000002031
100000002041
100000002059
100000002061
100000002097
100000002103
100000002181
100000002191
100000002199
100000002229
100000002251
100000002299
100000002313
100000002317
100000002353
100000002359
100000002373
100000002413
100000002497
100000002499
100000002503
100000002511
100000002539
100000002587
100000002617
100000002677
100000002689
100000002731
100000002757
100000002827
100000002847
100000002863
100000002889
100000002911
100000002913
100000002941
100000002943
100000002953
100000003039
100000003067
100000003069
100000003087
100000003097
100000003163
100000003211
100000003223
100000003241
100000003249
100000003277
100000003303
100000003319
100000003361
100000003373
100000003379
100000003381
100000003447
100000003457
100000003471
100000003517
100000003559
100000003583
100000003591
100000003627
100000003657
100000003661
100000003699
100000003709
100000003757
100000003759
100000003787
100000003813
100000003853
100000003867
100000003897
100000003921
100000003951
100000003997
100000004021
100000004053
100000004099
100000004107
100000004171
100000004177
100000004207
100000004267
100000004333
100000004407
100000004437
100000004449
100000004471
100000004483
100000004501
100000004521
100000004539
100000004591
100000004653
100000004677
100000004707
100000004719
100000004749
100000004761
100000004809
100000004827
100000004837
100000004843
100000004849
100000004861
100000004903
100000004917
100000004953
100000004987
54 changes: 54 additions & 0 deletions javausaco - Copy/Cryptography/src/RSA/Crypto.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package RSA;
import java.util.*;
import java.math.*;
public class Crypto {
public static char dc(int i) {
return (char) i;

}
public static int ec(char i) {
return (int) i;
}
public static BigInteger[] encrypt(String s, BigInteger n, BigInteger e) {
char[] sa=s.toCharArray();
BigInteger[] out=new BigInteger[sa.length];
int temp;
for(int i=0;i<sa.length;i++) {
temp=ec(sa[i]);
out[i]=BigInteger.valueOf(temp).modPow(e, n);
}

return out;
}
public static void go(BigInteger[] k) {
for(BigInteger a:k) {
System.out.print(a+",");

}
}
public static void main(String[] args) {
System.out.println("Encrypt or decrypt use d or e");
final BigInteger ONE=BigInteger.ONE;
Scanner sc=new Scanner(System.in);
String choice=sc.nextLine();
BigInteger n,e;
if(choice.equals("d")) {
System.out.println("Enter d");
BigInteger d=sc.nextBigInteger();
System.out.println("Enter n and e");
n=sc.nextBigInteger();
e=sc.nextBigInteger();
}else if(choice.equals("e")) {
System.out.println("Enter n and e and then your plaintext");
n=sc.nextBigInteger();
e=sc.nextBigInteger();
System.out.println("Please enter your plaintext");
go(encrypt(sc.nextLine(),n,e));
}else {
System.out.println("Invalid choice, terminating");
System.exit(1);

}//91,5,29
}

}
47 changes: 47 additions & 0 deletions javausaco - Copy/Cryptography/src/RSA/Test1.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package RSA;
import java.math.BigInteger;
import java.util.*;

public class Test1 {

public static void main(String[] args) {
// TODO Auto-generated method stub
boolean customprime=true;
Scanner sc=new Scanner(System.in);
System.out.println("P:");
BigInteger p=sc.nextBigInteger();
System.out.println("Q:");
BigInteger q=sc.nextBigInteger();
System.out.println("Calculating public key/encryption key");
BigInteger n=p.multiply(q);
BigInteger e=(p.subtract(BigInteger.ONE)).multiply(q.subtract(BigInteger.ONE)).subtract(BigInteger.ONE);
if(customprime) {
System.out.println("Custom primes is enabled. Please manually enter a relativley prime number to "+(e.add(BigInteger.ONE)));
e=sc.nextBigInteger();
}
System.out.println("Your public key is "+n+ ","+e);
System.out.println("Calculating private key/decryption key");
BigInteger i=p.subtract(BigInteger.ONE).multiply(q.subtract(BigInteger.ONE));
boolean found=false;
for(BigInteger d=BigInteger.ONE;!(found);d=d.add(BigInteger.ONE)) {
if(e.multiply(d).mod(i).equals(BigInteger.ONE)) {
System.out.println("It is:"+d);
found=true;
}else {
//System.out.println(d+","+i+","+e);
//System.out.println(e.multiply(d).mod(i));
}
//if(d.toString().equals("100")) {break;}
}
System.out.println("You also need the public key for decrypting");

}

}
/*
* Sample numbers
* 20,988,936,657,440,586,486,151,264,256,610,222,593,863,921
* 170,141,183,460,469,231,731,687,303,715,884,105,727
* 12027524255478748885956220793734512128733387803682075433653899983955179850988797899869146900809131611153346817050832096022160146366346391812470987105415233
* 12131072439211271897323671531612440428472427633701410925634549312301964373042085619324197365322416866541017057361365214171711713797974299334871062829803541
*/
5 changes: 5 additions & 0 deletions javausaco - Copy/GithubJavasync/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Java
Useful library for usaco and other purposes.
. Use releases when possible otherwise download usacotools.java.
# Release dates and more
Find release dates at https://javaarchive.github.io/Java/. Moved to https://github.com/javaarchive/Java/wiki
Binary file added javausaco - Copy/GithubJavasync/SimpleSorter.class
Binary file not shown.
9 changes: 9 additions & 0 deletions javausaco - Copy/GithubJavasync/SimpleSorter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

public class SimpleSorter {

public static void main(String[] args) {
// TODO Auto-generated method stub

}

}
Binary file added javausaco - Copy/GithubJavasync/Sorter.class
Binary file not shown.
8 changes: 8 additions & 0 deletions javausaco - Copy/GithubJavasync/Sorter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

public interface Sorter {
public int SortMode=0;
public void sort1();
public int[] sort2();
public String[] sort3();

}
Binary file added javausaco - Copy/GithubJavasync/Var.class
Binary file not shown.
Loading