A. Again Twenty Five!
time limit per test

0.5 seconds

memory limit per test

64 megabytes

input

standard input

output

standard output

The HR manager was disappointed again. The last applicant failed the interview the same way as 24 previous ones. "Do I give such a hard task?" — the HR manager thought. "Just raise number 5 to the power of n and get last two digits of the number. Yes, of course, n can be rather big, and one cannot find the power using a calculator, but we need people who are able to think, not just follow the instructions."

Could you pass the interview in the machine vision company in IT City?

Input

The only line of the input contains a single integer n (2 ≤ n ≤ 2·1018) — the power in which you need to raise number 5.

Output

Output the last two digits of 5n without spaces between them.

Examples
input
2
output
25
题解:我用快速幂写了下,其实感觉都是25的;
代码:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
const int INF=0x3f3f3f3f;
#define mem(x,y) memset(x,y,sizeof(x))
#define SI(x) scanf("%d",&x)
#define PI(x) printf("%d",x)
#define SD(x) scanf("%lf",&x)
#define P_ printf(" ")
typedef __int64 LL;
int main(){
LL n;
while(~scanf("%I64d",&n)){
int ans=,k=;
while(n){
if(n&)ans=k*ans%;
else k=k*k%;
n>>=;
}
printf("%d\n",ans);
}
return ;
}
B. Moore's Law
time limit per test

0.5 seconds

memory limit per test

64 megabytes

input

standard input

output

standard output

The city administration of IT City decided to fix up a symbol of scientific and technical progress in the city's main square, namely an indicator board that shows the effect of Moore's law in real time.

Moore's law is the observation that the number of transistors in a dense integrated circuit doubles approximately every 24 months. The implication of Moore's law is that computer performance as function of time increases exponentially as well.

You are to prepare information that will change every second to display on the indicator board. Let's assume that every second the number of transistors increases exactly 1.000000011 times.

Input

The only line of the input contains a pair of integers n (1000 ≤ n ≤ 10 000) and t (0 ≤ t ≤ 2 000 000 000) — the number of transistors in the initial time and the number of seconds passed since the initial time.

Output

Output one number — the estimate of the number of transistors in a dence integrated circuit in t seconds since the initial time. The relative error of your answer should not be greater than 10 - 6.

Examples
input
1000 1000000
output
1011.060722383550382782399454922040
题解:
n*pow(1.000000011,t),我竟然还想着快速幂;
代码:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
const int INF=0x3f3f3f3f;
#define mem(x,y) memset(x,y,sizeof(x))
#define SI(x) scanf("%d",&x)
#define PI(x) printf("%d",x)
#define SD(x) scanf("%lf",&x)
#define P_ printf(" ")
typedef __int64 LL;
int main(){
LL n,t;
while(~scanf("%I64d%I64d",&n,&t)){
printf("%.15f\n",n*pow(1.000000011,t));
}
return ;
}
C. Lucky Numbers
time limit per test

0.5 seconds

memory limit per test

64 megabytes

input

standard input

output

standard output

The numbers of all offices in the new building of the Tax Office of IT City will have lucky numbers.

Lucky number is a number that consists of digits 7 and 8 only. Find the maximum number of offices in the new building of the Tax Office given that a door-plate can hold a number not longer than n digits.

Input

The only line of input contains one integer n (1 ≤ n ≤ 55) — the maximum length of a number that a door-plate can hold.

Output

Output one integer — the maximum number of offices, than can have unique lucky numbers not longer than n digits.

Examples
input
2
output
6
题解:很好找的规律,按照位置来看,每个位置有两种选择7或者8;直接从1到n把所有情况加起来;
代码:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
const int INF=0x3f3f3f3f;
#define mem(x,y) memset(x,y,sizeof(x))
#define SI(x) scanf("%d",&x)
#define PI(x) printf("%d",x)
#define SD(x) scanf("%lf",&x)
#define P_ printf(" ")
typedef __int64 LL;
int main(){
int n;
while(~SI(n)){
LL ans=;
LL cur=;
for(int i=;i<=n;i++){
cur*=;
ans+=cur;
}
printf("%I64d\n",ans);
}
return ;
}
D. Hexagons!
time limit per test

0.5 seconds

memory limit per test

64 megabytes

input

standard input

output

standard output

After a probationary period in the game development company of IT City Petya was included in a group of the programmers that develops a new turn-based strategy game resembling the well known "Heroes of Might & Magic". A part of the game is turn-based fights of big squadrons of enemies on infinite fields where every cell is in form of a hexagon.

Some of magic effects are able to affect several field cells at once, cells that are situated not farther than n cells away from the cell in which the effect was applied. The distance between cells is the minimum number of cell border crosses on a path from one cell to another.

It is easy to see that the number of cells affected by a magic effect grows rapidly when n increases, so it can adversely affect the game performance. That's why Petya decided to write a program that can, given n, determine the number of cells that should be repainted after effect application, so that game designers can balance scale of the effects and the game performance. Help him to do it. Find the number of hexagons situated not farther than n cells away from a given cell.

Input

The only line of the input contains one integer n (0 ≤ n ≤ 109).

Output

Output one integer — the number of hexagons situated not farther than n cells away from a given cell.

Examples
input
2
output
19
题解:题读了半天,规律也找了好一会,然后超时,最后LL又挂了两次。。
for(int i=1;i<=n;i++){
    cur++;
    last++;
    ans+=(cur*2+last*4+2);
   }
规律总结下就是:(LL)(n+3)*n+(LL)n*(n-1)*2+(LL)2*n+1;
代码:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
const int INF=0x3f3f3f3f;
#define mem(x,y) memset(x,y,sizeof(x))
#define SI(x) scanf("%d",&x)
#define PI(x) printf("%d",x)
#define SD(x) scanf("%lf",&x)
#define P_ printf(" ")
typedef __int64 LL;
int main(){
int n;
while(~SI(n)){
//LL cur=1,last=-1,ans=1;
LL ans=(LL)(n+)*n+(LL)n*(n-)*+(LL)*n+;
/*for(int i=1;i<=n;i++){
cur++;
last++;
ans+=(cur*2+last*4+2);
}*/
printf("%I64d\n",ans);
}
return ;
}
F. Selection of Personnel
time limit per test

0.5 seconds

memory limit per test

64 megabytes

input

standard input

output

standard output

One company of IT City decided to create a group of innovative developments consisting from 5 to 7 people and hire new employees for it. After placing an advertisment the company received n resumes. Now the HR department has to evaluate each possible group composition and select one of them. Your task is to count the number of variants of group composition to evaluate.

Input

The only line of the input contains one integer n (7 ≤ n ≤ 777) — the number of potential employees that sent resumes.

Output

Output one integer — the number of different variants of group composition.

Examples
input
7
output
29
题解:规律很好推,关键在于LL上,应该每次乘直接除,要不会超LL
代码:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
const int INF=0x3f3f3f3f;
#define mem(x,y) memset(x,y,sizeof(x))
#define SI(x) scanf("%d",&x)
#define PI(x) printf("%d",x)
#define SD(x) scanf("%lf",&x)
#define P_ printf(" ")
typedef __int64 LL;
LL select(LL n){
LL ans=;
for(int i=;i<=;i++){
LL temp=;
for(int j=;j<=i;j++){
temp=temp*(n-j+)/j;
}
ans+=temp;
}
return ans;
}
int main(){
LL n;
while(~scanf("%I64d",&n)){
LL ans=select(n);
printf("%I64d\n",ans);
}
return ;
}
J. Divisibility
time limit per test

0.5 seconds

memory limit per test

64 megabytes

input

standard input

output

standard output

IT City company developing computer games invented a new way to reward its employees. After a new game release users start buying it actively, and the company tracks the number of sales with precision to each transaction. Every time when the next number of sales is divisible by all numbers from 2 to 10 every developer of this game gets a small bonus.

A game designer Petya knows that the company is just about to release a new game that was partly developed by him. On the basis of his experience he predicts that n people will buy the game during the first month. Now Petya wants to determine how many times he will get the bonus. Help him to know it.

Input

The only line of the input contains one integer n (1 ≤ n ≤ 1018) — the prediction on the number of people who will buy the game.

Output

Output one integer showing how many numbers from 1 to n are divisible by all numbers from 2 to 10.

Examples
input
3000
output
1
题解:直接找1到10的最小公倍数除以n取整就可以了;
代码:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
const int INF=0x3f3f3f3f;
#define mem(x,y) memset(x,y,sizeof(x))
#define SI(x) scanf("%d",&x)
#define PI(x) printf("%d",x)
#define SD(x) scanf("%lf",&x)
#define P_ printf(" ")
typedef __int64 LL;
LL gcd(LL a,LL b){
return b==?a:gcd(b,a%b);
}
int main(){
LL n;
while(~scanf("%I64d",&n)){
LL lcm=;
for(LL i=;i<=;i++){
lcm=lcm/gcd(lcm,i)*i;
}
printf("%I64d\n",n/lcm);
}
return ;
}
R. Game
time limit per test

0.5 seconds

memory limit per test

64 megabytes

input

standard input

output

standard output

There is a legend in the IT City college. A student that failed to answer all questions on the game theory exam is given one more chance by his professor. The student has to play a game with the professor.

The game is played on a square field consisting of n × n cells. Initially all cells are empty. On each turn a player chooses and paint an empty cell that has no common sides with previously painted cells. Adjacent corner of painted cells is allowed. On the next turn another player does the same, then the first one and so on. The player with no cells to paint on his turn loses.

The professor have chosen the field size n and allowed the student to choose to be the first or the second player in the game. What should the student choose to win the game? Both players play optimally.

Input

The only line of the input contains one integer n (1 ≤ n ≤ 1018) — the size of the field.

Output

Output number 1, if the player making the first turn wins when both players play optimally, otherwise print number 2.

Examples
input
1
output
1
input
2
output
2
题解:
谁先赢,奇偶喽
代码:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
const int INF=0x3f3f3f3f;
#define mem(x,y) memset(x,y,sizeof(x))
#define SI(x) scanf("%d",&x)
#define PI(x) printf("%d",x)
#define SD(x) scanf("%lf",&x)
#define P_ printf(" ")
typedef __int64 LL;
int main(){
LL n;
while(~scanf("%I64d",&n)){
printf("%d\n",n&?:);
}
return ;
}
N. Forecast
time limit per test

0.5 seconds

memory limit per test

64 megabytes

input

standard input

output

standard output

The Department of economic development of IT City created a model of city development till year 2100.

To prepare report about growth perspectives it is required to get growth estimates from the model.

To get the growth estimates it is required to solve a quadratic equation. Since the Department of economic development of IT City creates realistic models only, that quadratic equation has a solution, moreover there are exactly two different real roots.

The greater of these roots corresponds to the optimistic scenario, the smaller one corresponds to the pessimistic one. Help to get these estimates, first the optimistic, then the pessimistic one.

Input

The only line of the input contains three integers a, b, c ( - 1000 ≤ a, b, c ≤ 1000) — the coefficients of ax2 + bx + c = 0equation.

Output

In the first line output the greater of the equation roots, in the second line output the smaller one. Absolute or relative error should not be greater than 10 - 6.

Examples
input
1 30 200
output
-10.000000000000000 -20.000000000000000
由于a正负不确定需要max,min;
代码:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
const int INF=0x3f3f3f3f;
#define mem(x,y) memset(x,y,sizeof(x))
#define SI(x) scanf("%d",&x)
#define PI(x) printf("%d",x)
#define SD(x) scanf("%lf",&x)
#define P_ printf(" ")
typedef __int64 LL;
int main(){
double a,b,c;
while(~scanf("%lf%lf%lf",&a,&b,&c)){
double t=sqrt(b*b-*a*c);
printf("%.15f\n%.15f\n",max((-b+t)/(*a),(-b-t)/(*a)),min((-b+t)/(*a),(-b-t)/(*a)));
}
return ;
}

cf-公式专场的更多相关文章

  1. cf公式专场-续

    Benches Time Limit:500MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Statu ...

  2. “玲珑杯”线上赛 Round #17 河南专场 A: Sin your life(和化积公式)

    传送门 题意 略 分析 首先将sin(x)+sin(y)+sin(z)h转化成\(2*sin(\frac{x+y}2)*cos(\frac{x-y}2)+sin(z)\),而cos(z)=cos(-z ...

  3. cf之路,1,Codeforces Round #345 (Div. 2)

     cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅.....   ...

  4. [Recommendation System] 推荐系统之协同过滤(CF)算法详解和实现

    1 集体智慧和协同过滤 1.1 什么是集体智慧(社会计算)? 集体智慧 (Collective Intelligence) 并不是 Web2.0 时代特有的,只是在 Web2.0 时代,大家在 Web ...

  5. CF memsql Start[c]UP 2.0 A

    CF memsql Start[c]UP 2.0 A A. Golden System time limit per test 1 second memory limit per test 256 m ...

  6. CF(协同过滤算法)

    1 集体智慧和协同过滤 1.1 什么是集体智慧(社会计算)? 集体智慧 (Collective Intelligence) 并不是 Web2.0 时代特有的,只是在 Web2.0 时代,大家在 Web ...

  7. CH BR13数学(啥?-a^b≡a^b mod phi(p)+phi(p)(mod p)(b>=phi(p))公式)

    啥? Beta Round #13 (数学专场) 背景 有人写了一个RSA加密给我玩. 描述 我赌5毛前面两题的内容也就开头几句话平时会用到. 还是做点具体的东西吧. 求c^d Mod N 输入格式 ...

  8. 协同过滤(CF)算法

    1 集体智慧和协同过滤 1.1 什么是集体智慧(社会计算)? 集体智慧 (Collective Intelligence) 并不是 Web2.0 时代特有的,只是在 Web2.0 时代,大家在 Web ...

  9. POJ 1845-Sumdiv 题解(数论,约数和公式,逆元,高中数学)

    题目描述 给定A,B,求A^B的所有因数的和,再MOD 9901 输入 一行两个整数 A 和 B. 输出 一行,一个整数 样例输入 2 3 样例输出 15 提示 对于100%的数据满足:0 <= ...

  10. CF#462 div1 D:A Creative Cutout

    CF#462 div1 D:A Creative Cutout 题目大意: 原网址戳我! 题目大意: 在网格上任选一个点作为圆中心,然后以其为圆心画\(m\)个圆. 其中第\(k\)个圆的半径为\(\ ...

随机推荐

  1. shell基础——字符串处理(转载)

    Shell的字符串处理   1 得到长度   %x="abcd"  #方法一      %expr length $x      4  # 方法二      %echo ${#x} ...

  2. 新建Android项目的时候,选择SDK的区别

    选择新建一个Android项目时候,出现MiniMum Required SDK.Target SDK.Compile With.Theme,如下所示,分别是什么意思呢? MinMum Require ...

  3. 栈ADT的数组实现

    /* 栈的数组实现声明 */ struct StackRecord; typedef struct StackRecord *Stack; #define MinSstackSize 5 #defin ...

  4. 二探ListView

    使用draw9patch 打开内置terminal 输入CD C:\Users\Gaby\AppData\Local\Android\sdk 在该目录下输入draw9patch 导入图片,开始绘制 本 ...

  5. Wireshark入门与进阶系列(一)

    摘自http://blog.csdn.net/howeverpf/article/details/40687049 Wireshark入门与进阶系列(一) “君子生非异也,善假于物也”---荀子 本文 ...

  6. Android UI 使用HTML布局(直接打开server网页)

    非常多时候我们用HTML布局会更方便直接,记录一下. 我如今主要是直接调用server的网页(实际上是jsp的,仅仅是返回的是html).所以须要联网,第一步加入权限. <uses-permis ...

  7. Android UI目录

    Android UI目录 序:最近一直想进阶android应用开发,虽然对一些相关的android知识都大体熟悉,但是自己的android知识体系,经不起推敲.经不起高手的垂问.经过几个月的努力学习, ...

  8. Android 多线程:使用Thread和Handler (从网络上获取图片)

    当一个程序第一次启动时,Android会同时启动一个对应的主线程(Main Thread),主线程主要负责处理与UI相关的事件,如:用户的按键事件,用户接触屏幕的事件以及屏幕绘图事件,并把相关的事件分 ...

  9. ADO.Net连接模式

    1.SqlConnection类 (1).通过构造函数创建一个SqlConnection对象,可以同时指定连接字符串 (2).通过SqlConnection对象的Open()方法打开数据库连接 (3) ...

  10. sql生成20位数随机数

    declare @rnd nvarchar(50)set @rnd =''while LEN(@rnd)<20 begin set @rnd =@rnd + REPLACE ( CONVERT( ...