Forum Comments

Senior2019-Set 4 - Recursive Functions and CNS 4
In ACSL Contest Prep
kchen4000
Nov 17, 2019
2)e 3)a 12)b
0
Senior2019-Set 4 - Recursive Functions and CNS 4
In ACSL Contest Prep
kchen4000
Nov 17, 2019
0
1
Senior2019-Set 3 - Recursive Functions and CNS 3
In ACSL Contest Prep
kchen4000
Nov 10, 2019
hello world
1
0
Senior2019-Set 3 - Recursive Functions and CNS 3
In ACSL Contest Prep
kchen4000
Nov 10, 2019
2)a 3)A 12)D
1
0
Senior2019-Set 2 - Recursive Functions and CNS 2
In ACSL Contest Prep
kchen4000
Nov 06, 2019
1)c 2)e 11)c
0
Senior2019-Set 2 - Recursive Functions and CNS 2
In ACSL Contest Prep
kchen4000
Nov 06, 2019
Content media
0
1
Senior2019-Set 1 - Recursive Functions and CNS
In ACSL Contest Prep
kchen4000
Oct 29, 2019
1a 2d 3c package acsl.KaprekarRoutine; import java.util.*; import java.io.*; public class KaprekarRoutine { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new FileReader("data/test.in")); PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("data/test.out"))); for(int i = 0; i < 10; i++){ String initialValue = in.readLine(); ArrayList<String> previous = new ArrayList<String>(); previous.add(initialValue); int cycle = 0; String value = initialValue; Boolean done = true; while(done){ String difference = subtract(value); for(int j = 0; j < previous.size(); j++){ if(difference.equals(previous.get(j))||(difference.equals("0"))){ cycle = previous.size() - j+1; done = false; } } previous.add(value); value = difference; } if(value.equals("0")){ System.out.println("ZERO, "+(previous.size()-1)); } else{ if(cycle == 2){ System.out.println("Constant, "+value); } else{ if(cycle > 2){ System.out.println("Cycle, "+cycle); } } } } in.close(); out.close(); } public static String subtract(String value){ ArrayList<String> digits = new ArrayList<String>(); String[] temp = value.split(""); for(int i = 0; i < temp.length; i++){ digits.add(temp[i]); } String smallest = ""; Collections.sort(digits); for(int i = 0; i < temp.length; i++){ smallest = smallest + digits.get(i); } String largest = ""; Collections.reverse(digits); for(int i = 0; i < temp.length; i++){ largest = largest + digits.get(i); } int difference = Integer.parseInt(largest, 16)-Integer.parseInt(smallest, 16); return Integer.toString(difference, 16); } }
0
0
Python 1 - ACSL Timesheets
In AP Computer Science A
kchen4000
Sep 26, 2018
big_monies=0; for i in range(4): place=int(input("place:")) Time_Start=input("time start:") Time_end=input("time end:") if Time_Start=="1": Time_Start=float(9) elif Time_Start=="2": Time_Start=float(9.5) elif Time_Start=="3": Time_Start=float(10) elif Time_Start=="4": Time_Start=float(10.5) elif Time_Start=="5": Time_Start=float(11) elif Time_Start=="6": Time_Start=float(11.5) elif Time_Start=="7": Time_Start=float(12) elif Time_Start=="8": Time_Start=float(12.5) elif Time_Start=="9": Time_Start=float(13) elif Time_Start=="A": Time_Start=float(13.5) elif Time_Start=="B": Time_Start=float(14) elif Time_Start=="C": Time_Start=float(14.5) elif Time_Start=="D": Time_Start=float(15) elif Time_Start=="E": Time_Start=float(15.5) elif Time_Start=="F": Time_Start=float(16) elif Time_Start=="G": Time_Start=float(16.5) elif Time_Start=="H": Time_Start=float(17) if Time_end=="1": Time_end=float(9) elif Time_end=="2": Time_end=float(9.5) elif Time_end=="3": Time_end=float(10) elif Time_end=="4": Time_end=float(10.5) elif Time_end=="5": Time_end=float(11) elif Time_end=="6": Time_end=float(11.5) elif Time_end=="7": Time_end=float(12) elif Time_end=="8": Time_end=float(12.5) elif Time_end=="9": Time_end=float(13) elif Time_end=="A": Time_end=float(13.5) elif Time_end=="B": Time_end=float(14) elif Time_end=="C": Time_end=float(14.5) elif Time_end=="D": Time_end=float(15) elif Time_end=="E": Time_end=float(15.5) elif Time_end=="F": Time_end=float(16) elif Time_end=="G": Time_end=float(16.5) elif Time_end=="H": Time_end=float(17) Time=Time_end-Time_Start money=0 if place-10<0: money=Time*10 if 0<place-10<10: if Time-4>0: overtime=Time-4 money=overtime*12+4*8 elif Time-4<=0: money=Time*8 if 10<place-10<20: if Time-4>0: overtime=Time-4 money=overtime*24+4*12 elif Time-4<=0: money=Time*12 big_monies=big_monies+money print(money) print(big_monies)
0
0
k
kchen4000
More actions