SDUT 2763-好玩的五次方(大數類),sdut2763-大數

來源:互聯網
上載者:User

SDUT 2763-好玩的五次方(大數類),sdut2763-大數

好玩的五次方Time Limit: 1000ms   Memory limit: 65536K  有疑問?點這裡^_^題目描述

給你一些數,讓你找出一個最小未在這些數中出現的正整數。並且求出這個數的五次方。

輸入第一行輸入一個n,代表有n個數。(n<1000000)第二行輸入n個數,每個數小於10000000000。輸出

輸出結果

樣本輸入
31 7 2
樣本輸出
243
準備正式開擼java。。先來一發
import java.io.*;import java.util.*;import java.math.*;public class Main {public static void main(String[] args){Scanner in=new Scanner(System.in);int n,i;n=in.nextInt();int[] a=new int[n];for(i=0;i<n;i++)a[i]=in.nextInt();Arrays.sort(a);for(i=0;i<n-1;i++)if(a[i+1]-a[i]>1)break;BigInteger ans=new BigInteger(Integer.toString(a[i]+1));System.out.println(ans.pow(5));}}




聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.