大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
戳这里跳转至题目
#include#includeint main(){int i, cnt = 0;
char str[6] = {'\0'};
gets(str);
for(i = 0; i< strlen(str); i++){if (str[i] != ' ') cnt++;
}
printf("%d\n", cnt);
return 0;
}
P1055 [NOIP2008 普及组] ISBN 号码戳这里跳转至题目
#include#includeint main(){char str[15] = {'\0'};
scanf("%s", str);
int i, j, identify_code = 0;
int len = strlen(str);
for(i = 0, j = 1; i< len - 1; i++){if (str[i] == '-') continue;
else {identify_code += (str[i] - '0') * j;
j++;
}
}
identify_code %= 11;
if (identify_code != 10 && identify_code == str[len - 1] - '0') printf("Right\n");
else if (identify_code == 10 && str[len - 1] == 'X') printf("Right\n");
else if (identify_code != 10 && identify_code != str[len - 1] - '0') {str[len - 1] = identify_code + '0';
puts(str);
}
else {str[len - 1] = 'X';
puts(str);
}
return 0;
}
P1308 [NOIP2011 普及组] 统计单词数戳这里跳转至题目
cnt = 0
word = input().lower()
text = input().lower()
text = ' ' + text + ' '
text_a = text.split()
for item in text_a:
if (item == word):
cnt += 1
if (cnt != 0):
print(cnt, text.find(' ' + word + ' '))
else :
print(-1)
P2010 [NOIP2016 普及组] 回文日期戳这里跳转至题目
#include#include#define MAX 10000000
#define MAX1 100000
int main(){int i, j, t;
int arr[400] = {0};
for (i = 1, t = 0; i<= 12; i++){for (j = 1; j<= 31; j++){if (i == 2 && j == 30) break;
if ((i == 3 || i == 4 || i == 6 || i == 9) && j == 31) break;
arr[t++] = j % 10 * MAX + j / 10 * (MAX / 10) + i % 10 * MAX1 + i / 10 * (MAX1 / 10) + i / 10 * 1000 + i % 10 * 100 + j;
}
}
int date1, date2, cnt = 0;
scanf("%d\n%d", &date1, &date2);
for (i = 0; arr[i] != 0; i++){if (arr[i] >= date1 && arr[i]<= date2) cnt++;
}
printf("%d\n", cnt);
return 0;
}
P1012 [NOIP1998 提高组] 拼数戳这里跳转至题目
'''
python3取消了sort方法的cmp参数
若仍想使用就得导入cmp_to_key模块
'''
import sys
from functools import cmp_to_key
def mycmp(s1, s2):
if s1 + s2 >s2 + s1:
return 1
elif s1 + s2< s2 + s1:
return -1
else:
return 0
n = int(input())
li = input().split()
li.sort(key = cmp_to_key(mycmp), reverse = True)
print(''.join(li))
P5587 打字练习戳这里跳转至题目
def get_text(text : list):
while True:
line = list(input())
if line != ['E', 'O', 'F']:
delete(line)
text.append(line)
else :
break
def delete(line_test : list):
while '<' in line_test:
ind = line_test.index('<')
if ind:
line_test.pop(ind)
line_test.pop(ind - 1)
else :
line_test.pop(ind)
count = 0
li = []
li_1 = []
get_text(li)
get_text(li_1)
T = float(input())
for i in range(min(len(li),len(li_1))):
for j in range(min(len(li[i]), len(li_1[i]))):
if li[i][j] == li_1[i][j]:
count += 1
print(round(count / (T / 60)))
你是否还在寻找稳定的海外服务器提供商?创新互联www.cdcxhl.cn海外机房具备T级流量清洗系统配攻击溯源,准确流量调度确保服务器高可用性,企业级服务器适合批量采购,新人活动首月15元起,快前往官网查看详情吧