跳到正文

剪贴板

剪贴板 u7w13f08

nerdy69
原文
剪贴板信息

剪贴板信息

发布
收录
更新
C++
#include<bits/stdc++.h>
using namespace std;

string recipe[50]={
    "",
    "4light+honey=5pollen",
    "4diamond+2salt=amethyst",
    "2silk=2toilet paper",
    "moon=30rock",
    "mirror=3glass",
    "6sand=2glass",
    "2bomb+6fire=fire bomb",
    "bomb+6gas=2gas bomb",
    "bomb+2icicle=cryo bomb",
    "bomb+5bubble=bubble bomb",
    "2missile+fire=hel missile",
    "2missile+gas=2viper",
    "6stinger+2blood=2blood stinger",
    "honey+2blood=hel honey",
    "honey+gas=irey",
    "3rock+obsidian=moon",
    "5poo+2acid=latrine",
    "5missile+heavy=spikeball",
    "ring=ring magnet+diamond",
    "5light+rose=dahlia",
    "10leaf+5palm leaf=ygg",
    "2stick=plank",
    "4third eye=eyeball",
    "2disc+5rubber=bugatti",
    "6fang+2blood rose=vam fang",
    "8bomb=nuke",
    "2scythe+5blood=2blood scythe",
    "2ygg+orb=bloom",
    "2rna=dna",
    "dna=2rna",
    "dna+rna=20chromosome",
    "2lightning+2lithium=3fractal",
    "5rock+fire=2magma",
    "orb+10marble=2magic marble+glass",
    "nitrogen+2oxygen=2bomb",
    "plasma+2uranium+2plutomium=2nuke",
    "wind+2rock=4sand",
    "ele",
    "2knife+stick=scythe",
    "kitty+scythe=5bone+feather+sad+3blood",
    "10cactus+plasma=2golden cactus",
    "3glass+bomb=2heavy+pipe bomb",
    "hot water+2nitrogen=2acid",
    "hotwater+2fire=lava",
    "2disc+fire=2dvd",
    "3salt+gamma=2stardust",
    "4cactus+thorn=pinecone",
    "2obsidian+3rock=5glass",
    "moon+bomb=3heavy+5rock+5singularity+magma"
};

time_t makeTime(int y,int m,int d,int h,int mi=0){
    tm t={};
    t.tm_year=y-1900;
    t.tm_mon=m-1;
    t.tm_mday=d;
    t.tm_hour=h;
    t.tm_min=mi;
    t.tm_sec=0;
    t.tm_isdst=-1;
    return mktime(&t);
}

int getRecipe(time_t t){
    static time_t base=makeTime(2026,9,20,11);

    long long diff=(long long)t-base;
    long long hours=floor((long double)diff/3600.0L);

    int x=(38-1+hours)%49;

    if(x<0) x+=49;

    return x+1;
}

time_t readTime(){
    int y,m,d,h,mi;

    cout<<"请输入时间(YYYY MM DD HH MM):";
    cin>>y>>m>>d>>h>>mi;

    return makeTime(y,m,d,h,mi);
}

string formatTime(time_t t){
    tm *p=localtime(&t);

    char buf[30];

    strftime(
        buf,
        sizeof(buf),
        "%Y-%m-%d %H:%M",
        p
    );

    return buf;
}

void showRecipe(time_t t){
    int x=getRecipe(t);

    cout<<"\n========================================\n";
    cout<<"时间:"<<formatTime(t)<<"\n";
    cout<<"配方:第 "<<x<<" 个\n";
    cout<<"效果:"<<recipe[x]<<"\n";
    cout<<"========================================\n";
}

void showAround(time_t t){
    tm *p=localtime(&t);

    p->tm_min=0;
    p->tm_sec=0;

    time_t center=mktime(p);

    cout<<"\n附近配方:\n";
    cout<<"----------------------------------------\n";

    for(int i=-5;i<=5;i++){
        time_t cur=center+i*3600;
        int x=getRecipe(cur);

        cout<<formatTime(cur)
            <<"  第"<<setw(2)<<x<<"个  "
            <<recipe[x];

        if(i==0)
            cout<<"  <== 查询时间";

        cout<<"\n";
    }
}

void showFuture(){
    time_t now=time(nullptr);

    tm *p=localtime(&now);

    p->tm_min=0;
    p->tm_sec=0;

    time_t start=mktime(p);

    cout<<"\n未来49小时:\n";
    cout<<"----------------------------------------\n";

    for(int i=0;i<=49;i++){
        time_t cur=start+i*3600;
        int x=getRecipe(cur);

        cout<<formatTime(cur)
            <<"  第"<<setw(2)<<x<<"个  "
            <<recipe[x];

        if(i==0)
            cout<<"  <== 当前";

        cout<<"\n";
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    while(true){
        cout<<"\n";
        cout<<"========================================\n";
        cout<<"       49个重组配方查询器\n";
        cout<<"========================================\n";
        cout<<"1. 查看当前配方\n";
        cout<<"2. 查看未来49小时\n";
        cout<<"3. 查询指定时间\n";
        cout<<"0. 退出\n";
        cout<<"----------------------------------------\n";
        cout<<"请选择:";

        int op;
        cin>>op;

        if(op==0)
            break;

        if(op==1){
            time_t now=time(nullptr);
            showRecipe(now);
        }
        else if(op==2){
            showFuture();
        }
        else if(op==3){
            time_t t=readTime();

            showRecipe(t);
            showAround(t);
        }
        else{
            cout<<"输入错误。\n";
        }
    }

    return 0;
}