网络选拔赛系统

(1)

package tan;
import java.util.Scanner;
public class X {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String str=sc.nextLine();
        int counta=0,counte=0,counti=0,counto=0,countu=0;
        for(int i=0;i<str.length();i++)
        {
            if(str.charAt(i)=='a')
                counta++;
            else if(str.charAt(i)=='e')
                counte++;
            else if(str.charAt(i)=='i')
                counti++;
            else if(str.charAt(i)=='o')
                counto++;
            else if(str.charAt(i)=='u')
                countu++;
        }
        System.out.println("a:"+counta);
        System.out.println("e:"+counte);
        System.out.println("i:"+counti);
        System.out.println("o:"+counto);
        System.out.println("u:"+countu);
            }

}

(2)import java.util.Scanner;
public class ex4_2 {
    public static void main(String[] args) {
         int i,j=2,n,d,r;
         int[]x=new int[100];
          Scanner s=new Scanner(System.in);
          d=s.nextInt();
          r=s.nextInt();
          for (i=1;i<=d;i++)
             x[i]=i;
         while (j<=r)
         {
            for (i=j;i<=d;i++)
            {
            if (i%j==0)
                {
                   if (x[i]!=0)
                       x[i]=0;
                   else 
                             x[i]=i;
                     }
                 }
             j++;
                 }
             for (i=1;i<=d;i++)
                 if (x[i]!=0)
                     System.out.print(x[i]+",");
 }
}

(3)package ex4;
import java.util.Scanner;
public class ex4_2 {
    public static void main(String[] args) {
        int n,t,i;
        Scanner s=new Scanner(System.in);
        n=s.nextInt();
        if(n%2==0||n==1)
        {
                System.out.println("2^? mod "+n+"= 1");
        }
        else
        {
            int ans=1,cnt=0;
            while(ans!=1||cnt==0)
             {
                 cnt++;
                ans=(ans*2)%n;
             }
            System.out.println("2^"+cnt+" mod"+n+"= 1");
            }      
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值