赞
踩
第一次参加这种比赛,虽然是c类赛事,但是是ccf主办的,难度还是有点的,主要是前面签到题主要是思想,后面的题目难度太高,身为力扣只刷了一百多道题目的我解决不了,这几道我只做了B,C题,E题超时了,这些题目的时间限制实在是太高了,这次只能是来学习学习了。顺便附上一下自己的代码,有点丑勿喷,希望有大神能出个题解,感谢
- if __name__ in '__main__':
- Input = input()
- n,m = int(Input.split(' ')[0]),int(Input.split(' ')[1])
- MIN = min(n,m)
- MAX = max(n,m)
- first_x = MIN
- first_y = MIN
- if n == m:
- k = 1
- else:
- k = 2 if n<m else 3
- for i in range(2):
- if k == 0:
- distance = min(n-first_x,m-first_y)
- first_x += distance
- first_y += distance
- elif k == 1:
- distance = min(first_x,first_y)
- first_x -= distance
- first_y -= distance
- elif k == 2:
- distance = min(first_x,m-first_y)
- first_x -= distance
- first_y += distance
- elif k == 3:
- distance = min(n-first_x,first_y)
- first_x += distance
- first_y -= distance
- flag = 0
- if first_x == 0 and first_y == 0:
- k = 0
- flag = 1
- elif first_x == 0 and first_y == m:
- k = 3
- flag = 1
- elif first_x == n and first_y == 0:
- k = 2
- flag = 1
- elif first_x == n and first_y == m:
- k = 1
- flag = 1
- if flag == 0:
- if k == 0:
- if first_y == m:
- k = 3
- elif first_x == n:
- k = 2
- elif k == 1:
- if first_x == 0:
- k = 3
- elif first_y == 0:
- k = 2
- elif k == 2:
- if first_x == 0:
- k = 0
- elif first_y == m:
- k = 1
- elif k == 3:
- if first_y == 0:
- k = 0
- elif first_x == n:
- k = 1
- print(first_x,first_y)
-
- if __name__ in '__main__':
- Input = input()
- n,m = int(Input.split(' ')[0]),int(Input.split(' ')[1])
- n += 1
- top = 1
- while((n ** top) <= m):
- top += 1
- top -= 1
- temp = top
- nums = []
- while(top > 0):
- num = m // (n**top)
- m -= num * (n**top)
- nums.append(num)
- top -= 1
-
- if m > 0:
- nums.append(m)
-
- res = ''
- for i, snum in enumerate(nums):
- if snum == 0:
- temp -= 1
- continue
-
- if temp > 1 and snum > 1:
- res += str(snum) + 'x^' + str(temp) + '+'
- elif temp > 1 and snum == 1:
- res += 'x^' + str(temp) + '+'
- elif temp == 1 and snum > 1:
- res += str(snum) + 'x+'
- elif temp == 1 and snum == 1:
- res += 'x+'
- else:
- res += str(snum)
-
- temp -= 1
-
- print(res)
- import math
- def check(num):
- if num == 2 or num == 3:
- return True
- end = num ** (1/2)
- for i in range(2,int(end)+1):
- if num % i == 0:
- return False
- if num == 1:
- return False
- return True
- if __name__ in '__main__':
- n = int(input())
- res = 0
- for i in range(2,n):
- if check(i):
- if check(n-i) == False:
- if n-i != 1:
- res += 2
- else:
- res += 1
- end = n-i
- start = 2
- while(start < end):
- if (n-i) % start == 0:
- res += 2
- end /= start
- start += 1
- print(res)
-
-
-
希望这篇博客对你有帮助,希望有大神出一下题解!!!!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。