
本文共 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); }}
发表评论
最新留言
关于作者
