2019秋招笔试编程题 膨胀的牛牛
发布日期:2021-05-09 04:15:36 浏览次数:17 分类:博客文章

本文共 1448 字,大约阅读时间需要 4 分钟。

���������������

���������������������������������������������������������n������������������������������,���������������������������������������������������������,������������������������,������������������������������������������������������������������A,���������������������������������n������������������������������������������������������ 

������������:

������������������,���������������������������n���A(1 ��� n ��� 200, 1 ��� A ��� 1,000,000,000)
���������������n���������,������������������������������������������a_i(1 ��� a_i ��� 1,000,000,000)

������������:

������������������������,������������������������������

������������1:

������5 1
������2 1 3 1 2

������������1:

������4

���������������

���������������������������������������������������������������������������������������������,������������������������,������������������������������������ ������������������������������������������������������������������������������������������������������������������������������������������������������������OK������

 

Java ���������������

import java.util.Scanner;public class Main {    public static void main(String[] args) {        Scanner sc = new Scanner(System.in);        int n = sc.nextInt();        int a = sc.nextInt();        int m = a;        int temp;        for (int i = 0; i < n; i++) {            temp = sc.nextInt();            if(temp == m){                m=m*2;            }        }        System.out.println(m);    }}

 

上一篇:Java 使用流读文本数据时乱码 解决方法
下一篇:windows连接远程服务器报错'SSH' 不是内部或外部命令,也不是可运行的程序 或批处理文件 解决方案

发表评论

最新留言

网站不错 人气很旺了 加油
[***.192.178.218]2025年05月05日 03时48分29秒