test

warning: 这篇文章距离上次修改已过617天,其中的内容可能已经有所变动。

0xc0

原先写的幸运数,放在这里测试一下

#include "stdio.h"
int k1, k2;
bool isLucky(int a)
{ //isLucky(数,k1,k2)
int i, m;
for (i = 1, m = a; m / 10 >= 10; i++)
m = m / 10;
if (m == k1 || m == k2)
        return true;
    else
        return false;
}
int numOfnum(int a)
{
    int i, m;
    for (i = 1, m = a; m / 10 != 0; i++)
        m = m / 10; //判断位数i
    return i;
}
int numOfLucky(int a)
{
    int i, m, s;
    for (i = 1, m = a; m / 10 != 0; i++)
        m = m / 10; //判断位数i
    int b[i];
    for (m = i - 1, s = a; m >= 0; m--)
    {
        b[m] = s % 10;
        s = s / 10;
    } //给数组b赋上每位数
    for (m = 0, s = 0; m < i; m++)
        if (isLucky(b[m]))
            s++; //判断幸运数位数
    return s;
}
int main()
{
    int n;
    scanf("%d%d%d", &n, &k1, &k2);
    int a[n] = {0}, num[n] = {0};
    for (int i = 0; i < n; i++)
        scanf("%d", &a[i]);
    for (int i = 0; i < n; i++)
        num[i] = numOfLucky(a[i]); //num数组与a数组一一对应
    int s = 0;
    for (int i = 1; i < n; i++)
    {
        if (num[i] > num[i - 1] && num[i] > num[s])
            s = i;
        if (numOfnum(a[i]) > numOfnum(a[s]) && num[i] == num[s])
            s = i;
    }
    printf("%d %d %d", a[s], num[s], numOfnum(a[s]));
    return 0;
}

测试markdown

info:

#include <stdio.h>
int *place(int *a, int m, int n)
{
    int b[m][n] = {0};

    return *b;
}
int main()
{
    int num[50] = {0};
    int m, n;
    scanf("%d", &m);
    scanf("%d", &n);
    for (int i = 0; i < m; i++)
        for (int j = 0; j < n; j++)
            scanf("%d", &num[i * m + j]);
  
    for (int i = 0, s = -1; i < m; i++)
    {
        if (s == 1)
        {
            for (int j = 0; j < n; j++)
                printf("%3d", place(num, m, n)[i][j]);
            s = -1;
        }
        if (s == -1)
        {
            for (int j = n - 1; j >= 0; j--)
                printf("%3d", place(num, m, n)[i][j]);
            s = 1;
        }
    }
    return 0;
}
warning:
#include <stdio.h>

int *place(int *a, int m, int n)

{

    int b[m][n] = {0};

    return *b;

}

int main()

{

    int num[50] = {0};

    int m, n;

    scanf("%d", &m);

    scanf("%d", &n);

    for (int i = 0; i < m; i++)

        for (int j = 0; j < n; j++)

            scanf("%d", &num[i * m + j]);

    for (int i = 0, s = -1; i < m; i++)

    {

        if (s == 1)

        {

            for (int j = 0; j < n; j++)

                printf("%3d", place(num, m, n)[i][j]);

            s = -1;

        }

        if (s == -1)

        {

            for (int j = n - 1; j >= 0; j--)

                printf("%3d", place(num, m, n)[i][j]);

            s = 1;

        }

    }

    return 0;

}

测试JAVA

import java.util.Scanner;
public class One {
    public static boolean isYear(int y) {
        if (y%4==0) {
            return true;
        }
        else return false;
    }
    public static int getDay(int y,int m, int d) {
        int n=0;
        for(int i=1;i<=m-1;i++){
            switch(i){
                case 1:n+=31;break;
                case 2: if(isYear(y))n+=29;else n+=28;break;
                case 3:n+=31;break;
                case 4:n+=30;break;
                case 5:n+=31;break;
                case 6:n+=30;break;
                case 7:n+=31;break;
                case 8:n+=31;break;
                case 9:n+=30;break;
                case 10:n+=31;break;
                case 11:n+=30;break;
                case 12:n+=31;break;
                default:break;
            }
        }
        n+=d;
        return n;
    }
    public static void main(String[] args){
        Scanner i =new Scanner(System.in);
        int y = i.nextInt();
        int m = i.nextInt();
        int d = i.nextInt();
        System.out.println(isYear(y));
        System.out.println(getDay(y, m, d));
    }

}

测试收缩框嵌套

JAVA

public static void main(String[] args) {
        String a="\u4f18\u79c0";
        System.out.println(a);
    }
点击量5230次
最后修改于:2020年12月09日 20:25

已有 2 条评论

  1. c0 c0

    我直呼内行

  2. bbll bbll

    你成功用两只手掰动了我的一根手指[]

添加新评论