猫史档案馆


传作品专属代码区

用户:川下里予川下里予查看:7 回复:12 评论:7 创建时间:2022-07-29T10:54:06


(回帖代码(py,c,c++,kitten,hltm……)就行)


回复

上一页1 页 / 共 1下一页
SCS_user_LoeheodVOQSCS_user_LoeheodVOQ

hltm?

点赞0


评论


川下里予川下里予

#include<iostream>
using namespace std;
int main() {
    char x;
    cin >> x;
    cout << (int)x << endl;
    return 0;
}

点赞0


评论


川下里予川下里予

只能写py,c,c++,Java的

点赞0


评论


#逸一时误一世##逸一时误一世#

print('I dont want to say helloworld')

点赞0


评论


川下里予川下里予

from pgzrun import *
from xes import *

WIDTH = 720
HEIGHT = 540
music.play("bg.mp3")

#作答区域 询问
print("————————————本游戏是良心游戏哦!身体健康最重要!!————————————")
print("————————————不要点歪77!不要点她!!点枫原万叶和帝君!————————————")
move = input("1=超级容易模式,2=还算容易模式,3=有一些难模式,4=超级的难模式,5=地狱噩梦模式,13=极恶极限模式")





#创建各种角色
#{
bg = Actor("背景.png")
p = Actor("光标.png")
wave = Actor("海浪前一层", [340, 242])
wave2 = Actor("海浪后一层",  [380, 237])
wave3 = Actor("海浪前一层", [350, 412])
wave4 = Actor("海浪后一层",  [370, 402])
喵 = Actor("歪77.png", [1200, 242])
喵2 = Actor("歪77.png", [1600, 402])
over = Actor("结束页.png", [1100, 270])
#}
duck = Actor("枫原万叶.png", [1000, 235])
duck2 = Actor("钟离.png", [1000, 405])

def draw():
    #绘制角色
    #{
    bg.draw()
    duck.draw()
    duck2.draw()
    wave2.draw()
    wave.draw()
    wave4.draw()
    wave3.draw()
    喵.draw()
    喵2.draw()
    p.draw()
    over.draw()
    if end:
        screen.draw.text(str(score), [414, 298], fontsize=70, color=(255,20,147))
        music.stop()
    #}

#让光标跟随鼠标移动    
def on_mouse_move(pos):
    p.pos = pos

end = False
score = 0    
def on_mouse_down(pos):
    global score, end
    #点击鼠标时,如果光标p碰到duck则击中duck,得分
    if p.colliderect(duck):
        socre = score + 1
        duck.left = 800 #移出屏幕
        duck.y = 235 #出现高度
        score = score + 1 + int (move)
        sounds.lucky.play()
        
    #另一只鸭子
    #{ 
    if p.colliderect(duck2):
        duck2.left = 800
        duck2.y = 405
        score = score + 3 + int(move)
        sounds.lucky.play()
    #}
    
    #点击鼠标时,如果光标p碰到喵则击中喵,玩儿完
    if p.colliderect(喵):
        over.left = 0 
        end = True
        sounds.fail.play()
    #另一个喵
    #{
    if p.colliderect(喵2):
        over.left = 0
        end = True
        sounds.fail.play()
    #}

#海浪速度
#{
wave_speed = 2
wave2_speed = 2
wave3_speed = 2
wave4_speed = 2
#}

def update():
    global score
    #海浪的移动逻辑
    #{
    global wave_speed, wave2_speed, wave3_speed, wave4_speed
    wave.x = wave.x - wave_speed
    if wave.left < -80:
        wave_speed = -wave_speed
    if wave.right > 800:
        wave_speed = -wave_speed
        
    wave2.x = wave2.x - wave2_speed
    if wave2.left < -80:
        wave2_speed = -wave2_speed
    if wave2.right > 800:
        wave2_speed = -wave2_speed
        
    wave3.x = wave3.x - wave3_speed
    if wave3.left < -80:
        wave3_speed = -wave3_speed
    if wave3.right > 800:
        wave3_speed = -wave3_speed 
        
    wave4.x = wave4.x - wave4_speed
    if wave4.left < -80:
        wave4_speed = -wave4_speed
    if wave4.right > 800:
        wave4_speed = -wave4_speed 
    #}
    
    #小鸭子的移动逻辑
    duck.x = duck.x - 2 - int(move) #作答区域【创意区】改变鸭子移动速度
    if duck.right < 0:
        duck.left = 800 #移出屏幕
        duck.y = 235 #出现高度
    #作答区域,仿照118~121行,实现duck2的移动
    #作答区域 duck2的高度是405,其余和duck一样
    duck2.x = duck2.x - 2 - int(move)
    if duck2.right < 0:
        duck2.left = 800 
        duck2.y = 235 
    #喵的移动逻辑
    喵.x = 喵.x - 3 - (int(move) * 2)
    if 喵.right < 0:
        喵.left = 800
        喵.y = 235
    #另一个喵
    #{
    喵2.x = 喵2.x - 4 - (int(move) *2)
    if 喵2.right < 0:
        喵2.left = 800
        喵2.y = 405
    #}  


go()

点赞0


评论


川下里予川下里予

from random import *
print("骰子:")
nafk = input("    骰子限数(4,6,8,10,12,14,16):")
move = input("    骰子模式(1单数模式,2双数模式,3喵模式):")
nafk = int(nafk)
if move == "1":
    ic_crayn = randint(0,nafk)
    ic_cputr = randint(0,nafk)
    
if move == "2":
    ic_crayn = randint(1,nafk)
    ic_cputr = randint(1,nafk)
    if ic_crayn % 2 == 1:
        ic_crayn = ic_crayn - 1
    if ic_cputr % 2 == 1:
        ic_cputr = ic_cputr - 1
    
if move == "3":
    ic_crayn = randint(0,nafk)
    ic_cputr = randint(0,nafk)
    if ic_crayn % 2 == 1:
        ic_crayn = 0
    if ic_cputr % 2 == 1:
        ic_cputr = 0
    if ic_crayn % 4 == 1:
        ic_crayn = 0
    if ic_cputr % 4 == 1:
        ic_cputr = 0
    if ic_crayn == 8:
        ic_crayn = 0
    if ic_cputr == 8:
        ic_cputr = 0


    
print("[",str(ic_crayn),":",str(ic_cputr),"]")
if ic_crayn > ic_cputr: 
    print("a赢了,b输了")
elif ic_crayn < ic_cputr:
    print("a输了,b赢了")
else:
    print("ab平局")

点赞0


评论


川下里予川下里予

from pgzrun import *
from random import *

music.play("bgm.mp3")

WIDTH = 1080
HEIGHT = 720

print("角色均来自游戏:米哈游《喵》")

#创建各种角色
#{
bg = Actor("bg.png")
bg2 = Actor("bg.png", [7560+3780, 360])
br = Actor("barrier1.png", [1100, 600])
gold_show = Actor("gold_show.png", [960, 50])
fail = Actor("fail.png", [1620, 360])
life_show = Actor("life_show.png", [120, 50])
#}
#作答区域【创意区】修改角色的图片,如将kd变为你自己
kd = Actor("ys14.png", [280, 600])
gold = Actor("mora.png", [1100, 200])
rocket = Actor("slim1.png", [1100, 600])
magic = Actor("boso.png", [5000, 300])
rocket = Actor("slim2.png", [1100, 600])

num = 0 #金币数初始值
life = 20 #生命值初始值
def draw():
    bg.draw()
    bg2.draw()
    kd.draw()
    rocket.draw()
    gold.draw()
    magic.draw()
    br.draw()
    gold_show.draw()
    life_show.draw()
    screen.draw.text(str(life), [125, 38], fontsize=24)
    screen.draw.text(str(num), [970, 38], fontsize=24)
    fail.draw()

br_speed = 5 #障碍物初始速度
r_speed = 8 #火箭初始速度
def update():
    global num,life, br_speed, r_speed
    #背景的移动
    #{
    bg.x = bg.x - br_speed
    bg2.x = bg2.x - br_speed
    if bg.right < 0:
        bg.left = 7560
    if bg2.right < 0:
        bg2.left = 7560
    #}
    
    #可多的移动    
    #{
    if kd.bottom < HEIGHT:
        kd.y = kd.y + 8
    if keyboard.space == True:
        if kd.top > 0:
            kd.y = kd.y - 15
    #}
    
    #金币的移动
    #{
    gold.x = gold.x - 6
    if gold.right < 0:
        gold.left = 1100
        gold.y = randint(100, 600)
    #}
    #金币和可多的碰撞检测
    #{
    if kd.colliderect(gold):
        sounds.gold.play()
        gold.left = 1100
        gold.y = randint(100, 600)
        num = num + 1
    #}
    
    #障碍物的移动
    #{
    br.x = br.x - br_speed
    if br.right < 0:
        br.image = "barrier" + str(randint(1, 3)) + ".png"
        br.left = 1100
        br.y = randint(100, 600)
    #}
    #障碍物和可多的碰撞检测
    #{
    if kd.colliderect(br):
        sounds.barrier.play()
        br.image = "barrier" + str(randint(1, 3)) + ".png"
        br.left = 1100
        br.y = randint(100, 600)
        life = life - 1
    #}  
    
    #火箭的移动
    #{
    rocket.x = rocket.x - r_speed
    if rocket.right < 0:
        rocket.left = 3000
        rocket.y = randint(100, 600)
    #}
    #火箭和可多的碰撞检测
    #{
    if kd.colliderect(rocket):
        sounds.喵.play()
        rocket.left = 3000
        rocket.y = randint(100, 600)
        life = life - 1
    #}
    
    #游戏结束
    if life == 0:
        fail.left = 0
        music.stop()
        
    #盲盒的移动
    magic.x = magic.x - 10
    if magic.right < 0:
        magic.left = 8000
        magic.y = randint(100, 600)
    #盲盒和可多的碰撞检测
    if kd.colliderect(magic):
        magic.left = 8000
        magic.y = randint(100, 600)
        
        n = randint(1,3)
        #慢速模式
        if n == 1:
            br_speed = 0.5
            r_speed = 0.5
            music.pause()
            sounds.slow.play()
        #快速模式
        elif n == 2:
            br_speed = 20
            r_speed = 20
            music.unpause()
            sounds.fast.play()
        #正常模式
        #作答区域,补充else语句,设置正常模式下障碍物和火箭的速度
        else:
            br_speed = 30
            r_speed = 30
            music.unpause()
            sounds.normal.play()
            
        kd.image = "ys" + str(randint(1, 13)) + ".png"

    #段位结算
    if num <= 5:
        fail.image = "菜鸟.png"
    elif num <= 15:
        fail.image = "业余.png"
    elif num <= 30:
        fail.image = "专业.png"
    elif num <= 50:
        fail.image = "大师.png"
    elif num <= 75:
        fail.image = "传奇.png"
    #作答区域 补充else语句, 给游戏配置隐藏段位"逆天",图片【"逆天.png"】
    else:
        fail.image = "逆天.png"
    
    
go()

点赞0


评论


I快乐的乌云I一WindowsI快乐的乌云I一Windows

阅读程序写结果:

 
#include <iostream>
using namespace std;
string s;

long long magic(int l, int r) {
    long long ans = 0;
        for (int i = l; i <= r; ++i) {
        ans = ans * 4 + s[i] - ‘a’ + 1;
    }
return ans;
}

int main() {
    cin >> s;
    int len = s.length();
    int ans = 0;
    for (int l1 = 0; l1 < len; ++l1) {
        for (int r1 = l1; r1 < len; ++r1) {
            bool bo = true;
            for (int l2 = 0; l2 < len; ++l2) {
                for (int r2 = l2; r2 < len; ++r2) {
                    if (magic(l1, r1) == magic(l2, r2) 
                    	&& (l1 != l2 || r1 != r2)) 
                    	bo = false;
                }
            }
            
            if (bo) {
                ans += 1;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

输入:abacaba

点赞0


评论


毁灭者明世隐毁灭者明世隐

???

点赞0


评论


川下里予川下里予

anslist = [ "a" , "b" , "c" , "d" , "e" , "f" , "g" , "h" , "i" , "j" , "k" , "l" , "m" , "n" , "o" , "p" , "q" , "r" , "s" , "t" , "u" , "v" , "w" , "x" , "y" , "z" , "1" , "2" , "3" , "4" , "5" , "6" , "7" , "8", "9", "0"]
password = [ ]

import random

while True:
    index = random.randint(0,len(anslist)-1)
    letter = anslist[index]
    
    password.append(letter)
    anslist.pop(index)
    if len(password) == 4:
        break
    
#print(password)

print("-- -- --密码猜猜猜-- -- --")

while True:
    posCorrect = 0
    letterCorrect = 0
    
    print("正确密码由4个不重复的小写字母和数字组成,猜猜看!?")
    user = input("请输入:")
    userlist = list(user)
    ans = "ans"
    answer = "answer"
    ansilist = list(ans)
    answerilist = list(answer)
    

    if userlist == ansilist or userlist == answerilist or len(userlist) == 4 :
        print("go!" , end = "\n")
    elif len(userlist) != 4:
        print("别乱输!!!!!!!!!!!!!!!!!!!!!!!!" , end = "\n")
        continue
    #print(userlist)

    if password == userlist:
        a = "yes"
        print(a)
        break
    elif user == "ans":
        print("………………ge wu en ^^^^^^")
    elif user == "answer":
        print("答案:",password)
    else:
        a = "no"
        for i in range(4):
            if userlist[i] == password[i]:
                posCorrect = posCorrect + 1
        print("位置对:" , str(posCorrect))
        for o in range(4):
            #for t in range(4):
                #if userlist[o] == password[t]:
                    #letterCorrect = letterCorrect + 1
            if userlist[o] in password:
                letterCorrect = letterCorrect + 1
        print("字母对:" , str(letterCorrect))
        
        #难度增加
        #(作者大大告诉你:输入ans会有惊喜)

点赞0


评论


川下里予川下里予

import random
a = int(input(" so 喵all number "))
b = int(input(" so big number "))

rand = random.randint(a,b)
 
while True:# 无限循环,退出条件在最下面
    print('-------已生成一个' + str(a) + '-' + str(b) + '的随机数-------')
    count = 1 # 记录正确猜数的次数
    start = a # 范围内的最小值
    end = b # 范围内的最大值
 
    while count < 11:# 猜测次数上限为10次
        try:#正确输入整数,执行
            number = int(input('喵数字是什么?数字范围{}-{}:'.format(start,end)))
            if number < start or number > end:
                print('超出范围,请重新输入',end = "\n")
                continue
            elif number  ==  rand:
                print('BOOM!!!',end = "\n")
                break
            elif number > rand:
                print('大了,还有' + str(10-count) + '次机会',end = "\n")
                end = number
            else:
                print('小了,还有' + str(10-count) + '次机会',end = "\n")
                start = number
        except:# 输入的不是整数,执行
            print('''输入有误,请重新输入''',end = "\n")
            continue
        count += 1
    print('共猜测了',count, '次')
 
    if count > 10:
        print('次数用完,游戏失败。')
#  结束程序
    ending = input('''--------- --本轮游戏结束----- -----
        退出游戏请按1,继续下一轮游戏请按2\n''')
    if ending == '1':
        break# 按照提示输入1,这个程序结束
print('================================') # 单纯为了好看

点赞0


评论


川下里予川下里予

import random

a = int(input("最小值"))
b = int(input("最大值"))

ans = random.randint(a,b)

while True:
    my = int(input("正确数字是" + str(a) + "-" + str(b) + "的数,猜猜看"))
    if my < a or my > b:
        print("no got pleas!no!!")
    else:
        if my > ans:
            print("it's big")
            b = my
        elif my < ans:
            print("it's 喵all")
            a = my
        elif my == ans:
            print("yes")
            a = my
            b = my
            break

点赞0


评论