zoukankan      html  css  js  c++  java
  • 题目编号生成器

    【程序描述】

    利用C++随机函数编写了此程序,用于神犇们在各种OI网站上灵活地攻坚克难,检验他们自己的超高水平。

    【操作描述】

    F11。

    【结果描述】

    一个洛谷(www.luogu.org)网站中题目的ID编号(可能无此题,请尝试新的输出)。

    源代码:
    
    #include<cstdio>
    #include<cstdlib>
    #include<ctime>
    using namespace std;
    int main()
    {
        printf("< Copyright by X-Axis >
    
    ");
        printf("Just a reminder:
        This is for your reference only.
    
    
    ");
        printf("Luogu ID : ");
        srand(time(0));
        int t;
        while (1)
        {
              t=rand()%10;
              if (t<3&&t)
              {
                    printf("%d",t);
                    break;
              }
        }
        if (t==2)
        {
              printf("%d",rand()%7);
              t=rand()%10;
              printf("%d",t);
              if (t==9)
                printf("0");
              else
                printf("%d",rand()%10);
        }
        else
          for (int a=0;a<3;a++)
              printf("%d",rand()%10);
        printf("
    
    ");
        return 0;
    }

     

    一个CodeVS(www.codevs.cn)网站中题目的ID编号(可能无此题,请重试新的输出)。

    源代码:
    
    #include<cstdio>
    #include<cstdlib>
    #include<ctime>
    using namespace std;
    int main()
    {
        printf("< Copyright by X-Axis >
    
    ");
        printf("Just a reminder:
        This is for your reference only.
    
    
    ");
        printf("CodeVS Problem ID : ");
        srand(time(0));
        while (1)
        {
              int t=rand()%10;
              if (t<5&&t)
              {
                    printf("%d",t);
                    break;
              }
        }
        for (int a=0;a<3;a++)
          printf("%d",rand()%10);
        printf("
    
    ");
        return 0;
    }
  • 相关阅读:
    从原理层面掌握@InitBinder的使用【享学Spring MVC】
    array详解
    forward_list详解
    list详解
    deque详解
    vector详讲(三)实例
    vector详讲(二)迭代器
    vector详讲(一)
    numeric_limits<>函数
    seek()和tell()在文件里转移
  • 原文地址:https://www.cnblogs.com/Ackermann/p/5578059.html
Copyright © 2011-2022 走看看