From c6e35f76dfe3eefddd64ca64dda3ab1449048464 Mon Sep 17 00:00:00 2001 From: Aditya Naik Date: Wed, 9 May 2018 21:44:24 -0400 Subject: initial --- amazing/amazing | Bin 0 -> 102112 bytes amazing/amazing.cpp | 163 ++++++++++++++++++++++++++++++++++++++++++++++++++ amazing/amazing.in | 108 +++++++++++++++++++++++++++++++++ amazing/amazing.py | 4 ++ amazing/backup | 126 ++++++++++++++++++++++++++++++++++++++ average/average | Bin 0 -> 35696 bytes average/average.cpp | 119 ++++++++++++++++++++++++++++++++++++ average/average.in | 8 +++ lonesome/lonesome.cpp | 38 ++++++++++++ rfp/rfp | Bin 0 -> 63128 bytes rfp/rfp.cpp | 37 ++++++++++++ rfp/rfp.in | 32 ++++++++++ 12 files changed, 635 insertions(+) create mode 100755 amazing/amazing create mode 100644 amazing/amazing.cpp create mode 100644 amazing/amazing.in create mode 100644 amazing/amazing.py create mode 100644 amazing/backup create mode 100755 average/average create mode 100644 average/average.cpp create mode 100644 average/average.in create mode 100644 lonesome/lonesome.cpp create mode 100755 rfp/rfp create mode 100644 rfp/rfp.cpp create mode 100644 rfp/rfp.in diff --git a/amazing/amazing b/amazing/amazing new file mode 100755 index 0000000..9a65934 Binary files /dev/null and b/amazing/amazing differ diff --git a/amazing/amazing.cpp b/amazing/amazing.cpp new file mode 100644 index 0000000..e9bc8d6 --- /dev/null +++ b/amazing/amazing.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +using namespace std; +/* +rows +j 0 1 2 3 4 +i +0 <0 1 0 1 0> +1 <0 1 0 1 0> +2 <0 0 0 0 0> + */ +// struct sq{ +// sq* N; +// sq* S; +// sq* E; +// sq* W; +// int count; +// }; + + +char turn_left(char); +char turn_right(char); + +int main(){ + int b, w, count[100][100]={0}; + vector sq[100]; + string s; + + cin>>b>>w; + while(b>0){ + int count[100][100]={0}; + vector sq[100]; + string s; + + for(int i=0;i>s; + for(int j=0;j=0) && (wallj>=0 && wallj=0 && sq[i-1][j]=='0'){ + i--; + walli--; + count[i][j]++; + } + else{ + dir = turn_left(dir); + walli--; + wallj--; + } + } + else if(dir=='W'){ + if(j-1>=0 && sq[i][j-1]=='0'){ + j--; + wallj--; + count[i][j]++; + } + else{ + dir = turn_left(dir); + walli++; + wallj--; + } + } + else if(dir=='S'){ + if(i+14) + continue; + else if(sq[i][j]=='0') + visited[count[i][j]]++; + } + } + for(int k=0; k<5; k++) + cout<>b>>w; + } +} + +char turn_left(char dir){ + char new_dir; + if(dir=='E') + new_dir = 'N'; + else if(dir=='N') + new_dir = 'W'; + else if(dir=='W') + new_dir = 'S'; + else if(dir == 'S') + new_dir = 'E'; + return new_dir; +} + +char turn_right(char dir){ + char new_dir; + if(dir=='E') + new_dir = 'S'; + else if(dir=='N') + new_dir = 'E'; + else if(dir=='W') + new_dir = 'N'; + else if(dir == 'S') + new_dir = 'W'; + return new_dir; +} diff --git a/amazing/amazing.in b/amazing/amazing.in new file mode 100644 index 0000000..52d676a --- /dev/null +++ b/amazing/amazing.in @@ -0,0 +1,108 @@ +11 10 +0010000100 +0100000001 +0100000100 +1010000000 +0001000000 +0000000000 +0011011000 +0010000001 +0101000000 +0000000011 +0010100101 +2 24 +001100010000000000000000 +000010101100101000001010 +12 28 +1000100000101000010000100100 +0001001000000001001001000010 +0000000000000100000001000100 +1000011100000000000100000001 +0001000100010010000011000010 +0000100000000000000001101000 +0000000000000000001010000000 +0100000000010010000000100000 +0001000000110000101010100100 +0000110000001101000000001000 +0000100000111001000000100000 +0001101100000010111010111100 +29 6 +000000 +111000 +110011 +000000 +110011 +000000 +000100 +101000 +000000 +000100 +100001 +000100 +010000 +001010 +000000 +001010 +100110 +001100 +110000 +001000 +000001 +000100 +100000 +000000 +001000 +001100 +000000 +010000 +000000 +8 27 +110100000100000100010000000 +000000000001010101010000001 +000110110000010000010000001 +000100100001000001000000000 +000000001000111101000010010 +001000100100110001000010100 +001000000011000000000101000 +000000000000000100000001000 +11 24 +010000100000000001001001 +000000000101001000000110 +010000000010000000000101 +010010001100000001000001 +000100000000000000100100 +000100011010100000101000 +001001000100000000100101 +001001110000000000000001 +110011001000100001000000 +000000001000100100110100 +000010100000000000011001 +8 29 +01000110000000000000010000000 +11010101000000000011000000000 +00000000100100100000000000000 +11000100011000000000001010000 +00000001111000100000000000000 +00000011000000000000100100100 +00011100000111001100100000000 +00110000001000100000100011100 +5 3 +001 +010 +100 +000 +000 +9 3 +011 +000 +011 +000 +000 +000 +000 +000 +000 +2 11 +00000000001 +00111001000 +0 0 \ No newline at end of file diff --git a/amazing/amazing.py b/amazing/amazing.py new file mode 100644 index 0000000..6df6194 --- /dev/null +++ b/amazing/amazing.py @@ -0,0 +1,4 @@ + + +class square: + diff --git a/amazing/backup b/amazing/backup new file mode 100644 index 0000000..2ffcb12 --- /dev/null +++ b/amazing/backup @@ -0,0 +1,126 @@ +#include +#include +#include +using namespace std; +/* +rows +j 0 1 2 3 4 +i +0 <0 1 0 1 0> +1 <0 1 0 1 0> +2 <0 0 0 0 0> + */ +// struct sq{ +// sq* N; +// sq* S; +// sq* E; +// sq* W; +// int count; +// }; + + +char turn_left(char); +char turn_right(char); + +int main(){ + int b, w, count[100][100]={0}; + vector sq[100]; + string s; + + cin>>b>>w; + while(b>0){ + for(int i=0;i>s; + for(int j=0;j=0 && sq[i-1][j]=='0'){ + i--; + walli--; + } + else + dir = turn_left(dir); + } + else if(dir=='W'){ + if(j-1>=0 && sq[i][j-1]=='0'){ + j--; + wallj--; + } + else + dir = turn_left(dir); + } + else if(dir=='S'){ + if(i+14) + continue; + else if(sq[i][j]=='0') + visited[count[i][j]]++; + } + } + for(int k=0; k<5; k++) + cout<>b>>w; + } +} + +char turn_left(char dir){ + char new_dir; + if(dir=='E') + new_dir = 'N'; + else if(dir=='N') + new_dir = 'W'; + else if(dir=='W') + new_dir = 'S'; + else if(dir == 'S') + new_dir = 'E'; + return new_dir; +} + +char turn_right(char dir){ + char new_dir; + if(dir=='E') + new_dir = 'S'; + else if(dir=='N') + new_dir = 'E'; + else if(dir=='W') + new_dir = 'N'; + else if(dir == 'S') + new_dir = 'W'; + return new_dir; +} diff --git a/average/average b/average/average new file mode 100755 index 0000000..557795a Binary files /dev/null and b/average/average differ diff --git a/average/average.cpp b/average/average.cpp new file mode 100644 index 0000000..5627b61 --- /dev/null +++ b/average/average.cpp @@ -0,0 +1,119 @@ +#include +#include +#include +using namespace std; + +int find_gcd(int a, int b); +void printer(int c, int q, int num, int deno); + +int main(){ + int n, cnum=0; + cin>>n; + + while(n>0){ + cnum++; + int nm, sum=0; + for(int i=0; i>nm; + sum += nm; + } + int gcd; + int deno, num, q; + if(abs(sum)>=n){ + if(sum % n == 0){ + num = sum/n; + deno = 0; + q = 0; + } + else{ + gcd = find_gcd(sum,n); + while(gcd != 1){ + sum /= gcd; + n /= gcd; + gcd = find_gcd(sum,n); + } + q = (sum-(sum%n))/n; + num = sum%n; + deno = n; + } + } + else{ //abs(sum)> n; + + } +} + +void printer(int c, int q, int num, int deno){ + int dl=0, ql=0, nl=0, x=deno, y=q, z = num; + while (x /= 10) + dl++; + while(y /= 10) + ql++; + while(z /= 10) + nl++; + if(deno == 1 || deno == 0){ + if(num<0) + cout<<"Case "< +using namespace std; + +int main() +{ + int dur; + cin>>dur; + while(dur>0) + { + int deprecs, months, depmonth, i; + double dwp, amt, val, cur_depval, iments, deps[100]={0.0}; + bool nend; + + cin>>dwp>>amt>>deprecs; + for(i=0;i>depmonth>>deps[depmonth]; + + val = dwp+amt; + iments = amt/dur; + nend = true; + + for(months=0; ; ++months) + { + if(deps[months]>0) + cur_depval=deps[months]; + val -= val*cur_depval; + if(val>amt) + break; + amt -= iments; + } + if(months==1) + cout<>dur; + } + return 0; +} diff --git a/rfp/rfp b/rfp/rfp new file mode 100755 index 0000000..d71b577 Binary files /dev/null and b/rfp/rfp differ diff --git a/rfp/rfp.cpp b/rfp/rfp.cpp new file mode 100644 index 0000000..2a4f918 --- /dev/null +++ b/rfp/rfp.cpp @@ -0,0 +1,37 @@ +#include +#include +using namespace std; + +int main(){ + float req, pro; + cin>>req>>pro; + int rfpnum=0; + while(req>0) + { + int i, j, k; + float cost,curcost=1000000000, comp, curcomp=0, numcomp; + string trash, curname, name; + ++rfpnum; + for(i=0; i<=req; i++) + getline(cin, trash); + + for(j=0; j>cost>>numcomp; + comp = numcomp/req; + + if(comp>curcomp || (comp==curcomp && cost1) cout<<"\n"; + cout<<"RFP #"<>req>>pro; + } + return 0; +} diff --git a/rfp/rfp.in b/rfp/rfp.in new file mode 100644 index 0000000..f0bc2d6 --- /dev/null +++ b/rfp/rfp.in @@ -0,0 +1,32 @@ +6 4 +engine +brakes +tires +ashtray +vinyl roof +trip computer +Chevrolet +20000.00 3 +engine +tires +brakes +Cadillac +70000.00 4 +ashtray +vinyl roof +trip computer +engine +Hyundai +10000.00 3 +engine +tires +ashtray +Lada +6000.00 1 +tires +1 1 +coffee +Starbucks +1.50 1 +coffee +0 0 \ No newline at end of file -- cgit v1.2.3