Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hhhrrrttt222111 committed Oct 13, 2020
0 parents commit a237600
Show file tree
Hide file tree
Showing 105 changed files with 2,119 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
8 changes: 8 additions & 0 deletions Beginner/ATM (HS08TEST)/atm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
w, b = input().split()
w = int(w)
b = float(b)
if (w % 5 == 0 and b>(w+.5)):
b = b - w - 0.5
print('%.2f' % b)
else:
print('%.2f' % b)
7 changes: 7 additions & 0 deletions Beginner/Add Two Numbers (FLOW001)/add.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
T = int(input())
for tc in range(T):
# Read integers a and b.
(a, b) = map(int, input().split(' '))

ans = a + b
print(ans)
14 changes: 14 additions & 0 deletions Beginner/Ambiguous Permutations (PERMUT2)/permutation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
while True :
n = int(input())
if n == 0 :
break
else :
arr = input().split()
check = True
for i in range(n) :
if int(arr[int(arr[i]) - 1]) != i + 1 :
check = False
if check :
print('ambiguous')
else :
print('not ambiguous')
22 changes: 22 additions & 0 deletions Beginner/Chef And Operators (CHOPRT)/chef.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include <iostream>
using namespace std;


int main() {
int t;
int n, m;
cin >> t;
while(t--) {
cin >> n >> m;
if(n>m) {
cout<<">"<<endl;
}
if(n<m) {
cout<<"<"<<endl;
}
if(n==m) {
cout<<"="<<endl;
}
}
return 0;
}
26 changes: 26 additions & 0 deletions Beginner/Chef And Operators (CHOPRT)/chef.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import java.util.*;

class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner scan = new Scanner(System.in);
if(scan.hasNext()){
int t=scan.nextInt();
for(int i=0;i<t;i++){
int A = scan.nextInt();
int B = scan.nextInt();
if(A>B){
System.out.println(">");
}
else if(B>A){
System.out.println("<");
}
else{
System.out.println('=');
}
}
}
scan.close();
}
}
14 changes: 14 additions & 0 deletions Beginner/Chef And Operators (CHOPRT)/chef.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
t = int(input())

while t:
a, b = map(int, input().split(" "))

if a > b:
print('>')
elif a < b:
print('<')
else:
print('=')

t = t-1

23 changes: 23 additions & 0 deletions Beginner/Chef and Remissness (REMISS)/remiss.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include<stdio.h>

int main() {

int T, A, B;

scanf("%d", &T);

for(int i=1;i<=T;i++) {
scanf("%d %d", &A, &B);
if(A>B) {
printf("%d %d\n", A, A+B);
}
else if(A<B) {
printf("%d %d\n", B, A+B);
}
else if(A=B) {
printf("%d %d\n", B, A+B);
}
}

return 0;
}
22 changes: 22 additions & 0 deletions Beginner/Chef and Remissness (REMISS)/remiss.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import java.util.*;

class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner scan = new Scanner(System.in);
int t = scan.nextInt();
while(t!=0){
int a = scan.nextInt();
int b = scan.nextInt();
if(a>b){
System.out.print(a);
}else{
System.out.print(b);
}
System.out.println(" " + (a+b));
}
scan.close();

}
}
14 changes: 14 additions & 0 deletions Beginner/Chef and Remissness (REMISS)/remiss.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
t = int(input())

while t:
a, b = map(int, input().split(" "))

if a>b:
print(a, a+b)
elif a<b:
print(b, a+b)
else:
print(a, b)

t = t-1

22 changes: 22 additions & 0 deletions Beginner/Ciel and Receipt (CIELRCPT)/ceil.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include <iostream>
using namespace std;

int main() {
int t;
cin >> t;

while(t!=0) {
int n;
cin>>n;
int k = 2048, s=0;
for(int i=k;i>=1;i/=2) {
s += n/i;
n %= i;
if(n==0)
break;
}
cout<<s<<endl;
t--;
}
return 0;
}
36 changes: 36 additions & 0 deletions Beginner/Cutting Recipes (RECIPE)/recipe.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include <stdio.h>


int gcd(int a,int b) {
if(b==0)
return a;
else
return gcd(b,a%b);
}

int main(void) {

int t;
scanf("%d", &t);
while(t--) {

int n;
scanf("%d", &n);
int a[50], i=0;

for(i=0; i<n; i++)
scanf("%d", &a[i]);
int temp = gcd(a[0], a[1]);

for(i=2; i<n; i++) {
temp = gcd(temp, a[i]);
}

for(i=0; i<n; i++) {
a[i] = a[i]/temp;
printf("%d ", a[i]);
}
printf("\n");
}
return 0;
}
15 changes: 15 additions & 0 deletions Beginner/Decrement OR Increment (DECINC)/DECINC.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <iostream>
using namespace std;

int main() {
int n;

cin>> n;
if(n%4==0) {
cout<<n+1;
}
else {
cout<<n-1;
}
return 0;
}
17 changes: 17 additions & 0 deletions Beginner/Decrement OR Increment (DECINC)/DECINC.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import java.util.*;



class Codechef {
public static void main (String[] args) throws java.lang.Exception {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
if(n%4 == 0) {
n++;
} else {
n--;
}
System.out.println(n);
scan.close();
}
}
8 changes: 8 additions & 0 deletions Beginner/Decrement OR Increment (DECINC)/DECINC.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
n = int(input())

if n%4 == 0:
n = n+1
print(n)
else:
n = n-1
print(n)
10 changes: 10 additions & 0 deletions Beginner/Enormous Input Test (INTEST)/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
(n, k) = map(int, input().split(' '))

ans = 0

for i in range(n):
x = int(input())
if x % k == 0:
ans += 1

print(ans)
20 changes: 20 additions & 0 deletions Beginner/Find Remainder (FLOW002)/remainder.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <stdio.h>

int main() {
// Read the number of test cases.
int T;
scanf("%d", &T);
while (T>0) {
// Read the input a, b
int a, b;
scanf("%d %d", &a, &b);

// Compute the ans.
// Complete the below line.
int ans = a%b;
printf("%d\n", ans);
T--;
}

return 0;
}
21 changes: 21 additions & 0 deletions Beginner/Find Remainder (FLOW002)/remainder.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import java.util.Scanner;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner scan = new Scanner(System.in);
int N = scan.nextInt();

for (int i=0; i<N; i++)
{
int x = scan.nextInt();
int y = scan.nextInt();
System.out.println(x%y);
}


}
}
12 changes: 12 additions & 0 deletions Beginner/Find Remainder (FLOW002)/remainder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
n = int(input())
arr = []

for i in range(n):
a, b = input().split()
a = int(a)
b = int(b)
rem = a%b
arr.append(rem)

for i in range(n):
print(arr[i])
15 changes: 15 additions & 0 deletions Beginner/Finding Square Roots (FSQRT)/fsqrt.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <iostream.h>
#include <math.h>
using namespace std;
int main()
{
int t ;
long n;
cin >> t;
while (t--)
{
cin >> n;
cout << int(sqrt(n)) << "\n";
}
return 0;
}
21 changes: 21 additions & 0 deletions Beginner/Finding Square Roots (FSQRT)/fsqrt.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import java.util.*;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner scan = new Scanner(System.in);
int t, n;
double r = 1.0;
t = scan.nextInt();
for(int i=0;i<t;i++)
{
n = scan.nextInt();
r = Math.sqrt(n);
n = (int)Math.floor(r);
System.out.println(n);
}
scan.close();
}
}
9 changes: 9 additions & 0 deletions Beginner/Finding Square Roots (FSQRT)/fsqrt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# cook your dish here
import math

t = int(input())

for i in range(t):
a = int(input())
sq = math.sqrt(a)
print(int(sq))
Loading

0 comments on commit a237600

Please sign in to comment.