uva 10523 Very Easy !!!
来源:互联网 发布:阿里云 幕布申请 编辑:程序博客网 时间:2024/05/18 00:06
Description
THE SAMS' CONTEST
Problem 4
VERY EASY !!!
BACKGROUND
Most of the times, the students of Computer Science & Engineering of BUET deal with bogus, tough and very complex formulae. That is why, sometimes, even for a easy problem they think very hard and make the problem much complex to solve. But, the team members of the team "BUET PESSIMISTIC" are the only exceptions. Just like the opposite manner, they treat every hard problem as easy and so cannot do well in any contest. Today, they try to solve a series but fail for treating it as hard. Let them help.
Input
Just try to determine the answer for the following series
You are given the value of N and A (integer, 1<=N<=150 & integer, 0<=A<=15) respectively.
Output
For each line of the input, your correct program should output the integer value of the sum in separate lines for each pair of values of N & A.
Sample Input
3 34 4
Sample Output
1021252
Anupam Bhattacharjee ( BUET PESSIMISTIC )
E means exponent, E means error. So try to avoid exponent whenever possible.
题意:计算图中的那个公式,给你的是n和a。
做法:直接用java大数来计算,非常方便。
import java.math.BigInteger;import java.util.*;public class Main {public static void main(String[] args) { Scanner scanf=new Scanner(System.in); BigInteger a,b,c; int i,n; while(scanf.hasNext()) { BigInteger t=new BigInteger("1"); BigInteger t1=new BigInteger("1"); BigInteger ans=new BigInteger("0"); n=scanf.nextInt(); a=scanf.nextBigInteger(); for(i=1;i<=n;i++) { t=t.multiply(a); t1=t.multiply(BigInteger.valueOf(i)); ans=ans.add(t1); } System.out.println(ans); } }}
- Uva 10523 Very Easy!!!
- UVa 10523 - Very Easy !!!
- uva 10523 Very Easy !!!
- uva 10523 Very Easy !!! 大数模拟加法和乘法
- (数组应用二:高精度运算4.2.2)UVA 10523 VERY EASY !!! (大数累加)
- [字符串]Very easy
- Another Very Easy Task
- RMQ问题-very easy-打印模板
- ZOJ 3406 Another Very Easy Task
- ACdream1008:A Very Easy Triangle Counting Game
- zoj 3406 Another Very Easy Task
- acdream1008 A Very Easy Triangle Counting Game
- python - pytest - Very easy sample in steps
- 《数据结构编程实验》 4.2.2VERY EASY !!!
- Easy Climb UVA
- Easy Climb UVA
- OpenMediaEngine - Very easy to use API for media streaming
- 群赛11.10 A Very Easy Triangle Counting Game
- C++ 语法实验室之mutable关键字
- ListView学习(带图片)
- 【牛腩新闻发布系统】——CSS学习
- QCustomPlot使用手册(一)
- 数据挖掘学习笔记1:引论
- uva 10523 Very Easy !!!
- 欧拉计划(10)Summation of primes
- 写博客的原因
- yuv420存储为JPG
- PowerDesigner--comment和name互相复制
- 【数据结构】回顾散列表
- 企业级监控平台开发之nagios二次开发(七)
- JSONObject与JSONArray的使用
- 第59题 Merge Two Sorted Lists