CCF Python題解(100分)201409-3 字串匹配
CCF Python題解(100分)201409-3 字串匹配
import re
s = input()
flag = input() # 1大小寫敏感
n = int(input())
for i in range(n):
inputstr = input()
if flag == '1': # 大小寫敏感
if s in inputstr:
print(inputstr)
else:
# 這幾個方法都是生成新字串,並不對原字串做任何修改
if s.upper() in inputstr. upper():
print(inputstr)
相關推薦
CCF Python題解(100分)201409-3 字串匹配
CCF Python題解(100分)201409-3 字串匹配 import re s = input() flag = input() # 1大小寫敏感 n = int(input()) for i in range(n): inputstr = input() i
CCF Python題解(100分)201709-3 JSON查詢
CCF Python題解(100分)201709-3 JSON查詢 # _*_ coding=utf-8 _*_ __author__ = 'SRF' __date__ = '2018/8/26 15:37' # r''都不會被轉義 import json n, m = map(int
CCF Python題解(100分)201312-3 最大的矩形
CCF Python題解(100分)201312-3 最大的矩形 n = int(input()) data = list(map(int, input().split())) def square(index): count = 1 for i in range(i
CCF Python題解(100分)201403-3 命令列選項
CCF Python題解(100分)201403-3 命令列選項 form = input() n = int(input()) def judge(str3): flag = True for k in str3: if not (k.islower
CCF Python題解(100分)201412-3 集合競價
CCF Python題解(100分)201412-3 集合競價 from collections import defaultdict records = [] def zero(): return 0 buy = defaultdict(zero) sell = de
CCF Python題解(100分)201503-3 節日
CCF Python題解(100分)201503-3 節日 a, b, c, y1, y2 = map(int, input().split()) data = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] def day(y
CCF Python題解(100分)201509-3模板生成系統
CCF Python題解(100分)201509-3模板生成系統 #變數名由大小寫字母、數字和下劃線 (_) 構成,且第一個字元不是數字,長度不超過 16 個字元。 #模板不遞迴生成。也就是說,如果變數的值中包含形如 {{ VAR }} 的內容,不再做進一步的替換。 import re
CCF Python題解(100分)201604-3 路徑解析
CCF Python題解(100分)201604-3 路徑解析 import re P = int(input()) currentdir = input() for i in range(P): relpath = input() if relpath: # 空字串
CCF Python題解(100分)201703-3 Markdown
CCF Python題解(100分)201703-3 Markdown import re raw = "" while True: try: inputStr = input() Str1 = re.sub("_(.*?)_", "<e
CCF Python題解(100分)201809-3 元素選擇器
CCF Python題解(100分)201809-3 元素選擇器 n, m = map(int, input().split()) textlist = [] for i in range(n): text = input() level = text.count('.'
CCF Python題解(100分)201712-2 遊戲
CCF Python題解(100分)201712-2 遊戲 # _*_ coding=utf-8 _*_ __author__ = 'SRF' __date__ = '2018/8/26 14:30' # n 上次記錄到的值 # import sys # sys.setrecursi
CCF Python題解(100分)201803-2 碰撞的小球
CCF Python題解(100分)201803-2 碰撞的小球 from collections import defaultdict n, L, t = map(int,input().split()) positions = map(int,input().split()) li
CCF Python題解(90分)201512-3 畫圖
CCF Python題解(90分)201512-3 畫圖 m, n, q = map(int, input().split()) canvas = [['.'] * m for i in range(n)] emoj = ['-', '|', '+'] def fill(x, y,
CCF Python題解(100分)201609-2 火車購票
n = int(input()) seats = [[1] * 5 for i in range(20)] num = list(map(int, input().split())) def seat(k): if k == 1:
python ccf題解 201409-3 字串匹配
問題描述 給出一個字串和多行文字,在這些文字中找到字串出現的那些行。你的程式還需支援大小寫敏感選項:當選項開啟時,表示同一個字母的大寫和小寫看作不同的字元;當選項關閉時,表示同一個字母的大寫和小寫看作相同的字元。 輸入格式 輸入的第一行包含一個字串S,由大小寫英文字母組
CCF Python題解(60分)201604-4 遊戲
CCF Python題解(60分)201604-4 遊戲 # 最短路徑 廣義優先搜尋 BFS # 所以有時候需要在一些地方踱步,等過了這段時間再前行,就不能簡單地限制為進入過的格不能再進入。 from collections import deque visited = [[[0 fo
CCF 201409-3 字串匹配
試題編號: 201409-3 試題名稱: 字串匹配 時間限制: 1.0s 記憶體限制: 256.0MB 問題描述: 問題描述 給出一個字串和多行文字,在這些文字中找到字串出現的那些行。你的程式還需支援大小寫敏感
CSP201409-3(字串匹配)(Java 100分)
問題描述 給出一個字串和多行文字,在這些文字中找到字串出現的那些行。你的程式還需支援大小寫敏感選項:當選項開啟時,表示同一個字母的大寫和小寫看作不同的字元;當選項關閉時,表示同一個字母的大寫和小寫看作相同的字元。 輸入格式 輸入的第一行包含一個字串S,由大小寫英文字母組成。
201412-2 CCF CSP Z字形掃描(Python實現100分)
試題編號:201412-2 試題名稱:Z字形掃描 時間限制:2.0s 記憶體限制:256.0MB 問題描述:問題描述 在影象編碼的演算法中,需要將一個給定的方形矩陣進行Z字形掃描(Zigz
CCF-買菜-Python(100分)
試題編號: 201809-2 試題名稱: 買菜 時間限制: 1.0s 記憶體限制: 256.0MB 問題描述: 小H和小W來到了一條街上,兩人分開買菜,他們買菜的過程可以描述為,去店裡買一些菜然後去旁邊的一個廣場把菜裝上車,兩人都要買n種菜,所以也都要裝n