-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e31e2be
commit e0ac404
Showing
23 changed files
with
394 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include<stdio.h> | ||
|
||
while True: | ||
|
||
n = int(input()) | ||
|
||
if n == 0: | ||
break | ||
|
||
for x in range(1, (n + 1), 1): | ||
if x == n: | ||
print(x) | ||
else: | ||
print(str(x) + ' ', end='') |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include<stdio.h> | ||
|
||
n = input().split() | ||
|
||
aux = 1 | ||
if int(n[aux]) <= 0: | ||
while True: | ||
if int(n[aux]) <= 0: | ||
aux+= 1 | ||
if int(n[aux]) > 0: | ||
break | ||
|
||
a, n, aux = int(n[0]), int(n[aux]), int(n[0]) | ||
|
||
for x in range(1, n): | ||
a += (aux + x) | ||
|
||
print(a) | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include<stdio.h> | ||
|
||
x = int(input()) | ||
aux = x | ||
cont = 1 | ||
while True: | ||
z = int(input()) | ||
|
||
if z > x: | ||
break | ||
|
||
for c in range(0, z): | ||
if x <= z: | ||
x += (aux + c) | ||
cont += 1 | ||
|
||
|
||
|
||
print(cont) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include<stdio.h> | ||
|
||
n = int(input()) | ||
|
||
aux = 0 | ||
aux_2 = 0 | ||
c = 0 | ||
|
||
for x in range(1, (n + 1)): | ||
if x == 1: | ||
print(str(c) + ' ', end='') | ||
c += 1 | ||
else: | ||
if x == (n): | ||
c += aux | ||
print(c) | ||
else: | ||
if x == 3: | ||
aux_2 = c | ||
aux = 0 | ||
c += aux | ||
print(str(c) + ' ', end='') | ||
aux = aux_2 | ||
else: | ||
aux_2 = c | ||
c += aux | ||
print(str(c) + ' ', end='') | ||
aux = aux_2 | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#include<stdio.h> | ||
|
||
n = int(input()) | ||
|
||
for x in range((n - 1), 0, -1): | ||
n *= x | ||
|
||
print(n) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include<stdio.h> | ||
|
||
t = 0 | ||
c = 0 | ||
|
||
while True: | ||
n = int(input()) | ||
|
||
if n < 0: | ||
print('%.2f' %(t / c)) | ||
break | ||
else: | ||
t += n | ||
c += 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include<stdio.h> | ||
|
||
s = 1 | ||
aux = 2 | ||
|
||
for x in range(3, 40, 2): | ||
s+= (x / aux) | ||
aux *= 2 | ||
|
||
print('%.2f' %(s)) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include<stdio.h> | ||
|
||
n = int(input()) | ||
|
||
for x in range(1, (n + 1)): | ||
if (n % x) == 0: | ||
print(x) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include<stdio.h> | ||
|
||
n = int(input()) | ||
|
||
for c in range(0, n): | ||
n = input().split() | ||
x, y = int(n[0]), int(n[1]) | ||
|
||
if (x % 2) == 0: | ||
x += 1 | ||
|
||
aux = x | ||
x = 0 | ||
|
||
for d in range(aux, (aux + (y * 2)), 2): | ||
x += d | ||
|
||
print(x) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include<stdio.h> | ||
|
||
|
||
|
||
while True: | ||
n = int(input()) | ||
|
||
if n == 0: | ||
break | ||
|
||
if (n % 2) != 0: | ||
n += 1 | ||
|
||
aux = n | ||
n = 0 | ||
|
||
for d in range(aux, (aux + (10)), 2): | ||
n += d | ||
|
||
print(n) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include<stdio.h> | ||
# http://muitomaiscodigoss.blogspot.com/2018/09/uri-problema-1160-crescimento.html #zzzzzzzzzzzzz | ||
|
||
n = int(input()) | ||
|
||
for i in range(0, n): | ||
pa, pb, ga, gb = map(float, input().split()) | ||
pa = int(pa) | ||
pb = int(pb) | ||
ano = 0 | ||
while pb >= pa: | ||
pa = int(pa * (1 + ga / 100)) | ||
pb = int(pb * (1 + gb / 100)) | ||
ano = ano + 1 | ||
if ano >= 101: | ||
print('Mais de 1 seculo.') | ||
break | ||
if ano <= 100: | ||
print('%d anos.'%(ano)) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include<stdio.h> | ||
|
||
n = int(input()) | ||
|
||
for i in range(0, n): | ||
cont = 0 | ||
y = int(input()) | ||
|
||
for x in range(1, y): | ||
if (y % x) == 0: | ||
cont += x | ||
|
||
if cont == y: | ||
print('%d eh perfeito' %(y)) | ||
else: | ||
print('%d nao eh perfeito' %(y)) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include<stdio.h> | ||
|
||
n = int(input()) | ||
|
||
for i in range(0, n): | ||
cont = 0 | ||
y = int(input()) | ||
|
||
for x in range(1, y): | ||
if (y % x) == 0: | ||
cont += 1 | ||
|
||
if cont == 1: | ||
print('%d eh primo' %(y)) | ||
else: | ||
print('%d nao eh primo' %(y)) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include<stdio.h> | ||
|
||
v = [] | ||
|
||
for i in range(0, 10): | ||
v.append(int(input())) | ||
|
||
if v[i] <= 0: | ||
v[i] = 1 | ||
|
||
for i in range(0, 10): | ||
print('X[%d] = %d' %(i, v[i])) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include<stdio.h> | ||
|
||
v = [] | ||
|
||
n = int(input()) | ||
|
||
for i in range(0, 10): | ||
if i == 0: | ||
v.append(n) | ||
else: | ||
n *= 2 | ||
v.append(n) | ||
|
||
for f in range(0, 10): | ||
print('N[%d] = %d' %(f, v[f])) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include<stdio.h> | ||
|
||
v = [] | ||
|
||
for i in range(0, 100): | ||
v.append(float(input())) | ||
|
||
for f in range(0, 100): | ||
if v[f] <= 10: | ||
print('A[%d] = %.1f' %(f, v[f])) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include<stdio.h> | ||
|
||
v = [] | ||
|
||
for i in range(0, 20): | ||
v.append(int(input())) | ||
|
||
v.reverse() | ||
|
||
for f in range(0, 20): | ||
print('N[%d] = %d' %(f, v[f])) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include<stdio.h> | ||
|
||
v = [] | ||
|
||
x = 0 | ||
aux = 0 | ||
aux_2 = 0 | ||
for i in range(0, 100): | ||
if i == 0: | ||
v.append(0) | ||
x += 1 | ||
else: | ||
if i == 1: | ||
aux = 0 | ||
x = 1 | ||
x += aux | ||
v.append(x) | ||
else: | ||
aux_2 = x | ||
x += aux | ||
aux = aux_2 | ||
v.append(x) | ||
|
||
n = int(input()) | ||
|
||
for j in range(0, n): | ||
n = int(input()) | ||
print('Fib(%d) = %d' %(n, v[n])) | ||
|
||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include<stdio.h> | ||
|
||
n = int(input()) | ||
|
||
aux = 0 | ||
|
||
for i in range(0, 1000): | ||
print('N[%d] = %d' %(i, aux)) | ||
if aux == (n - 1): | ||
aux = 0 | ||
else: | ||
aux += 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include<stdio.h> | ||
|
||
x = float(input()) | ||
|
||
for i in range(0, 100): | ||
print('N[%d] = %.4f' %(i, x)) | ||
x /= 2 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include<stdio.h> | ||
|
||
par = [] | ||
impar = [] | ||
|
||
tPar = 0 | ||
tImpar = 0 | ||
|
||
for i in range(0, 15): | ||
n = int(input()) | ||
|
||
if (n % 2) == 0: | ||
par.append(n) | ||
tPar += 1 | ||
else: | ||
impar.append(n) | ||
tImpar += 1 | ||
|
||
if tPar == 5: | ||
for j in range(0, tPar): | ||
print('par[%d] = %d' %(j , par[j])) | ||
|
||
del par [:] | ||
tPar = 0 | ||
|
||
if tImpar == 5: | ||
for j in range(0, tImpar): | ||
print('impar[%d] = %d' %(j , impar[j])) | ||
|
||
del impar [:] | ||
tImpar = 0 | ||
|
||
if i == 14: | ||
for j in range(0, tImpar): | ||
print('impar[%d] = %d' %(j , impar[j])) | ||
|
||
for j in range(0, tPar): | ||
print('par[%d] = %d' %(j , par[j])) | ||
|
Oops, something went wrong.