4thirteen2one
4thirteen2one
全部文章
分类
题解(37)
归档
标签
去牛客网
登录
/
注册
4thirteen2one的博客
TA的专栏
1篇文章
0人订阅
我的刷题记录
1篇文章
353人学习
全部文章
(共29篇)
题解 | #HJ106 字符串逆序#
C语言版本 #include <stdio.h> #include <string.h> int main() { char content[10001]; int length; scanf("%[^\n]", content, &leng...
C
Python3
2022-04-17
1
1069
题解 | #HJ45 名字的漂亮度#
Python版本 import sys def histogram(string): histo = {} for c in string: histo[c] = histo.get(c, 0) + 1 return histo def func(stri...
Python3
2022-04-17
0
552
题解 | #HJ8 合并表记录#
Python 版本 n = int(input()) table = {} for i in range(n): k, v = map(int, input().split(' ')) if k in table: table[k] += v else: ...
Python3
C
2022-04-17
10
2567
题解 | #HJ101 输入整型数组和排序标识,对其元素按照升序或降序进行排序#
Python版本 n = int(input()) vals = [i for i in map(int, input().strip().split())] order = input() if order == '0': vals.sort(reverse=False) elif or...
Python3
2022-04-17
4
669
题解 | #HJ33 整数与IP地址间的转换#
Python 版本 def ip2num(ip): temp = ip.split('.') num = 0 num = sum([int(s)*(256**(len(temp)-i-1)) for i,s in enumerate(temp)]) return nu...
Python3
2022-04-17
0
530
题解 | #HJ23 删除字符串中出现次数最少的字符#
Python版本 content = input() index_map = {chr(i):[] for i in range(ord('a'), ord('z')+1)} for i, c in enumerate(content): index_map[c].append(i) # ...
Python3
2022-04-17
0
1426
题解 | #HJ20 密码验证合格程序#
Python版本 import sys def check(passwd): status = True if len(passwd) >= 8: flags = [False] * 4 for c in passwd: ...
Python3
2022-04-17
0
1083
题解 | #HJ17 坐标移动#
Python+正则表达式 import re s = input() mvs = [mv for mv in s.split(';') if re.match(r"^([AWSD]\d{1,2})?$", mv)] x, y = 0, 0 for mv in mvs: if mv: ...
Python3
C
2022-04-17
0
285
题解 | #HJ46 截取字符串#
C语言版本 思路:调用 string.h 中的 strncpy #include <stdio.h> #include <string.h> int main() { char string[1000]; scanf("%s", string); i...
C
Python3
2022-04-17
9
1105
首页
上一页
1
2
3
下一页
末页