solved a1p3 and submitted assignment
This commit is contained in:
parent
32b04527ab
commit
2b1b79a3c7
@ -1,21 +1,21 @@
|
|||||||
def main():
|
def main():
|
||||||
lines: list[str] = []
|
lines: list[str] = []
|
||||||
t = int(input())
|
t = int(input())
|
||||||
while (t != 0):
|
while (t != 0):
|
||||||
lines.append(input())
|
lines.append(input())
|
||||||
t -= 1
|
t -= 1
|
||||||
|
|
||||||
for line in lines:
|
for line in lines:
|
||||||
h, w = [int(n) for n in line.split()]
|
h, w = [int(n) for n in line.split()]
|
||||||
for y in range(h):
|
for y in range(h):
|
||||||
print('*' * ((w * 3) + 1))
|
print('*' * ((w * 3) + 1))
|
||||||
row = '*..' * w + '*'
|
row = '*..' * w + '*'
|
||||||
|
|
||||||
print(row)
|
print(row)
|
||||||
print(row)
|
print(row)
|
||||||
|
|
||||||
print('*' * ((w * 3) + 1))
|
print('*' * ((w * 3) + 1))
|
||||||
print()
|
print()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
@ -1,37 +1,40 @@
|
|||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
int t;
|
int t;
|
||||||
std::scanf("%d", &t);
|
std::scanf("%d", &t);
|
||||||
|
|
||||||
while (t--) {
|
while (t--) {
|
||||||
int n;
|
int n;
|
||||||
std::scanf("%d", &n);
|
std::scanf("%d", &n);
|
||||||
|
|
||||||
if (n == 1) {
|
if (n == 1) {
|
||||||
std::cout << "0" << std::endl;
|
std::cout << "0" << std::endl;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
int total = 1;
|
int total = 1;
|
||||||
int r = (int) std::floor(std::sqrt(n));
|
int r = (int) std::floor(std::sqrt(n));
|
||||||
|
|
||||||
for (int n2 = 2; n2 < r + 1; n2++) {
|
std::cout << std::endl;
|
||||||
if (n % n2 == 0) {
|
|
||||||
int other = n / n2;
|
for (int n2 = 2; n2 < r + 1; n2++) {
|
||||||
|
if (n % n2 == 0) {
|
||||||
if (other != n)
|
int other = n / n2;
|
||||||
total += other;
|
|
||||||
|
if (other != n2) {
|
||||||
total += n2;
|
total += other;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
total += n2;
|
||||||
std::cout << total << std::endl;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
std::cout << total << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
BIN
DIVSUM/a.out
BIN
DIVSUM/a.out
Binary file not shown.
@ -1,23 +0,0 @@
|
|||||||
def main():
|
|
||||||
lines: list[str] = []
|
|
||||||
t = int(input())
|
|
||||||
while (t != 0):
|
|
||||||
lines.append(input())
|
|
||||||
t -= 1
|
|
||||||
|
|
||||||
print()
|
|
||||||
for line in lines:
|
|
||||||
n = int(line)
|
|
||||||
|
|
||||||
if n == 1:
|
|
||||||
print(0)
|
|
||||||
continue
|
|
||||||
|
|
||||||
total = 1
|
|
||||||
for n2 in reversed(range(2, n)):
|
|
||||||
total += n2 if n % n2 == 0 else 0
|
|
||||||
|
|
||||||
print(total)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
|
|
||||||
d = {1 : 0}
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
lines: list[str] = []
|
|
||||||
t = int(input())
|
|
||||||
while (t != 0):
|
|
||||||
lines.append(input())
|
|
||||||
t -= 1
|
|
||||||
|
|
||||||
print()
|
|
||||||
for line in lines:
|
|
||||||
n = int(line)
|
|
||||||
|
|
||||||
if n == 1:
|
|
||||||
print(0)
|
|
||||||
continue
|
|
||||||
|
|
||||||
total = 1
|
|
||||||
for n2 in reversed(range(2, n)):
|
|
||||||
total += n2 if n % n2 == 0 else 0
|
|
||||||
|
|
||||||
print(total)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
#include <cstdio>
|
|
||||||
#include <iostream>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <cmath>
|
|
||||||
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
int t = 200000;
|
|
||||||
// std::scanf("%d", &t);
|
|
||||||
|
|
||||||
while (t--) {
|
|
||||||
int n;
|
|
||||||
// std::scanf("%d", &n);
|
|
||||||
|
|
||||||
n = std::rand() % 500000 + 1;
|
|
||||||
|
|
||||||
if (n == 1) {
|
|
||||||
std::cout << "0" << std::endl;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
int total = 1;
|
|
||||||
int r = (int) std::floor(std::sqrt(n));
|
|
||||||
|
|
||||||
for (int n2 = 2; n2 < r + 1; n2++) {
|
|
||||||
if (n % n2 == 0)
|
|
||||||
total += n2 + (n/n2);
|
|
||||||
// std::cout << n2 << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::cout << total << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,15 +1,15 @@
|
|||||||
def main():
|
def main():
|
||||||
lines = []
|
lines = []
|
||||||
t = int(input())
|
t = int(input())
|
||||||
while (t != 0):
|
while (t != 0):
|
||||||
lines.append(input())
|
lines.append(input())
|
||||||
t -= 1
|
t -= 1
|
||||||
|
|
||||||
# Do Problem
|
# Do Problem
|
||||||
for line in lines:
|
for line in lines:
|
||||||
for char in range(0, len(line)//2, 2):
|
for char in range(0, len(line)//2, 2):
|
||||||
print(line[char], end='')
|
print(line[char], end='')
|
||||||
print()
|
print()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
@ -1,5 +0,0 @@
|
|||||||
4
|
|
||||||
your
|
|
||||||
progress
|
|
||||||
is
|
|
||||||
noticeable
|
|
||||||
@ -1,19 +1,19 @@
|
|||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
while (1) {
|
while (1) {
|
||||||
int n;
|
int n;
|
||||||
std::scanf("%d", &n);
|
std::scanf("%d", &n);
|
||||||
|
|
||||||
if (n == 42) {
|
if (n == 42) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << n << std::endl;
|
std::cout << n << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
24
TEST/main.py
24
TEST/main.py
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
while True:
|
while True:
|
||||||
n = int(input())
|
n = int(input())
|
||||||
|
|
||||||
if n == 42:
|
if n == 42:
|
||||||
break
|
break
|
||||||
print(n)
|
print(n)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user