训练赛(一)

Description

Given the number n, find the smallest positive integer which has exactlyn divisors. It is guaranteed that for the givenn the answer will not exceed 1018.

Input

The first line of the input contains integer n (1 ≤ n ≤ 1000).

Output

Output the smallest positive integer with exactly n divisors.

Sample Input

Input
4
Output
6
Input
6
Output
12

 

E:  给一个n,要求输出一个拥有n个因子的最小的整数 ;n<1000,输出的这个数不会超过10^18 ;

直接枚举素因子;因为一个数 n=p1^k1*p2^k2... ;因子数为 (k1+1)*(k2+1).. ;   比如 756=2^2*3^3*7^1  ,因子数为 (2+1)*(3+1)*(1+1)=24 ;

#include<iostream>
#include<cstring>
using namespace std;
const long long oo=1000000000000000009;
const int p[]={2,3,5,7,11,13,17,19,23,29};
int n;
long long ans;
void dfs(int dep,long long tmp,int x)  //dep为枚举到的因子数,tmp为当前枚举到的数,x为当前枚举到第x个素因子; 
{ if(dep>n)return;
  if(dep==n&&ans>tmp){ans=tmp;return;}
  for(int i=1;i<=64;i++)///最多,2^64会爆  ,每个素因子数的指数最多64 ; 
  { if(ans<tmp*p[x])break;
    dfs(dep*(i+1),tmp*=p[x],x+1);
  }
}
int main()
{
    while(cin>>n)
    {
     ans=oo;
      dfs(1,1,0);
      cout<<ans<<"\n";
    }
}


A - Next Test

«Polygon» is a system which allows to create programming tasks in a simple and professional way. When you add a test to the problem, the corresponding form asks you for the test index. As in most cases it is clear which index the next test will have, the system suggests the default value of the index. It is calculated as the smallest positive integer which is not used as an index for some previously added test.

You are to implement this feature. Create a program which determines the default index of the next test, given the indexes of the previously added tests.

Input

The first line contains one integer n (1 ≤ n ≤ 3000) — the amount of previously added tests. The second line containsn distinct integersa1, a2, ..., an (1 ≤ ai ≤ 3000) — indexes of these tests.

Output

Output the required default value for the next test index.

Sample Input

Input
3
1 7 2
Output
3

 

A:  有一堆数,加入一个数,会输出这堆最小的整数,给出n个已经输出来的数,求下一个可能输出的数;

哈希标记水过 ;

#include<cstdio>
#include<cstring>
#include<map>
#include<vector>
#include<cmath>
#include<cstdlib>
#include<stack>
#include<queue>
#include <iomanip>
#include<iostream>
#include<algorithm>
using namespace std ;

int main()
{
	int  n,i ;
	int a[3500];
	int flag[3500]; 
	while(~scanf("%d",&n))
	{
		memset(flag,0,sizeof(flag));
		   for( i = 0 ; i <n ; i++)
		    {
			     scanf("%d",&a[i]);
		         flag[a[i]] =1 ;
		    }
		    i=1;
		    while(1)
			{
				  if(flag[i]) i++;
				  else  break;
			} 
		    printf("%d\n",i);
	}
	 return 0;
} 


 

B - Tournament

Crawling in process...Crawling failedTime Limit:2000MS    Memory Limit:262144KB    64bit IO Format:%I64d & %I64u

 

Description

The tournament «Sleepyhead-2010» in the rapid falling asleep has just finished inBerland.n best participants from the country have participated in it. The tournament consists of games, each of them is a match between two participants.n· (n - 1) / 2 games were played during the tournament, and each participant had a match with each other participant.

The rules of the game are quite simple — the participant who falls asleep first wins. The secretary made a record of each game in the form «xiyi», wherexi andyi are the numbers of participants. The first number in each pair is a winner (i.e.xi is a winner andyi is a loser). There is no draws.

Recently researches form the «Institute Of Sleep» have found that every person is characterized by a valuepj — the speed of falling asleep. The person who has lower speed wins. Every person has its own valuepj, constant during the life.

It is known that all participants of the tournament have distinct speeds of falling asleep. Also it was found that the secretary made records about all the games except one. You are to find the result of the missing game.

Input

The first line contains one integer n (3 ≤ n ≤ 50) — the number of participants. The followingn· (n - 1) / 2 - 1 lines contain the results of the games. Each game is described in a single line by two integersxi, yi (1 ≤ xi, yi ≤ n, xi ≠ yi), where xi иyi are the numbers of the opponents in this game. It is known that during the tournament each of then participants playedn - 1 games, one game with each other participant.

Output

Output two integers x and y — the missing record. If there are several solutions, output any of them.

Sample Input

Input
4
4 2
4 1
2 3
2 1
3 1

Sample Output

Output
4 3

 

B: n个比赛,一共比n*(n-1)/2场比赛,每个人都会与其余的人比赛;给出n*(n-1)/2-1场比赛的结果(x,y),表示x赢y,还剩一场比赛的结果数据丢失,

要你找回来,输出这场比赛的结果; 首先找出是哪两个人的结果还没有;在输出的过程中统计每个人赢的场数,然后那两个人中的谁赢的多,那么这场必然也是他赢;

#include<cstdio>
#include<cstring>
#include<map>
#include<vector>
#include<cmath>
#include<cstdlib>
#include<stack>
#include<queue>
#include <iomanip>
#include<iostream>
#include<algorithm>
using namespace std ;

int win[100],s[100];
int main()
{
    int  n,a,b;
	while(~scanf("%d",&n))
	{	        
	      memset(win,0,sizeof(win));
	      memset(s,0,sizeof(s));
	      int top=0;
	   	    for(int i = 0 ; i < n*(n-1)/2-1 ; i++)
		    {
		    	   scanf("%d%d",&a,&b);
		    	   win[a]++;
				   s[a]++;s[b]++;
		    }
		    int k1=0,k2=0,f1=1,f2=1;
			 for(int i = 1 ; i <= n ; i++)
			 {
			 	  if(s[i]!=(n-1) && f1)
			 	    {			 	     
					  k1=i,f1=0;
					  continue;
				    }
			 	   if(s[i]!=(n-1) && f2)
			 	     k2=i,f2=0;  			 	
			 }
		
			 if(win[k1]>win[k2])
			 printf("%d %d\n",k1,k2);
			 else
			 printf("%d %d\n",k2,k1);
			
	}
	 return 0;
} 


 

C - Unordered Subsequence

Crawling in process...Crawling failedTime Limit:2000MS    Memory Limit:262144KB    64bit IO Format:%I64d & %I64u

 

Description

The sequence is called ordered if it is non-decreasing or non-increasing. For example, sequnces [3, 1, 1, 0] and [1, 2, 3, 100] are ordered, but the sequence [1, 3, 3, 1] is not. You are given a sequence of numbers. You are to find it's shortest subsequence which is not ordered.

A subsequence is a sequence that can be derived from the given sequence by deleting zero or more elements without changing the order of the remaining elements.

Input

The first line of the input contains one integer n (1 ≤ n ≤ 105). The second line containsn space-separated integers — the given sequence. All numbers in this sequence do not exceed106 by absolute value.

Output

If the given sequence does not contain any unordered subsequences, output 0. Otherwise, output the length k of the shortest such subsequence. Then outputk integers from the range [1..n] — indexes of the elements of this subsequence. If there are several solutions, output any of them.

Sample Input

Input
5
67 499 600 42 23
Output
3
1 3 5
Input
3
1 2 3
Output
0
Input
3
2 3 1
Output
3
1 2 3

 

C:  给一个序列,找出一个最短的子序列,这个子序列要求是即不上身,也不下降的;比如 1 5 3  ;显然最短的只有只有3个 ;  

#include<cstdio>
#include<cstring>
#include<map>
#include<vector>
#include<cmath>
#include<cstdlib>
#include<stack>
#include<queue>
#include <iomanip>
#include<iostream>
#include<algorithm>
using namespace std ;
int main()
{
	int n,i,j;
	int a[110000];
	while(~scanf("%d",&n))
	{
	
	for( i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
	}
	int k=2 ;
	while(a[1]==a[k]) k++;
	
	int x,flag=0;
	if(a[k]>a[1])
	{
		for( i=k+1;i<=n;i++)
		{
			if(a[i]<a[i-1])
			{
				x=i;
				flag=1;
				break;
			}
		}
	}
	if(a[k]<a[1])
	{
		for(i=k+1;i<=n;i++)
		{
			if(a[i]>a[i-1])
			{
				x=i;
				flag=1;
				break;
			}
		}
	}
	if(flag)
	{
		   printf("3\n");
		   printf("1 %d %d\n",x-1,x);
	}
	else printf("0\n");
}
	return 0;
}

 

 

G - CD

Crawling in process...Crawling failedTime Limit:3000MS    Memory Limit:0KB    64bit IO Format:%lld & %llu

 

Description

You have a long drive by car ahead. You have a tape recorder, but unfortunately your best music is on CDs. You need to have it on tapes so the problem to solve is: you have a tapeN minutes long. How to choose tracks from CD to get most out of tape space and have as short unused space as possible.

Assumptions:

  • number of tracks on the CD. does not exceed 20
  • no track is longer than N minutes
  • tracks do not repeat
  • length of each track is expressed as an integer number
  • N is also integer

Program should find the set of tracks which fills the tape best and print it in the same sequence as the tracks are stored on the CD

Input

Any number of lines. Each one contains value N, (after space) number of tracks and durations of the tracks. For example from first line in sample data: N=5, number of tracks=3, first track lasts for 1 minute, second one 3 minutes, next one 4 minutes

Output

Set of tracks (and durations) which are the correct solutions and string ``sum:" and sum of duration times.

Sample Input

5 3 1 3 4
10 4 9 8 4 2
20 4 10 5 7 4
90 8 10 23 1 2 3 4 5 7
45 8 4 10 44 43 12 9 8 2

Sample Output

1 4 sum:5
8 2 sum:10
10 5 4 sum:19
10 23 1 2 3 4 5 7 sum:55
4 10 12 9 8 2 sum:45

 

G :  有k张CD,每张CD播放时间为a[i],有一台收音机,收音机只能播放N分钟;要求选择一些CD来放,使得收音机尽可能播得久,

注意CD的播放总时间不能超过收音机的要求时间 。 很明显是个 01背包问题 ,再就是记录路径 ;

f[i][j]表示前i件CD播放时间为 j 时的最大价值; 当然这题,价值和花费都是a[i] ;

#include<cstdio>
#include<cstring>
#include<map>
#include<vector>
#include<cmath>
#include<cstdlib>
#include<stack>
#include<queue>
#include <iomanip>
#include<iostream>
#include<algorithm>
using namespace std ;
int f[1000][11000],w[1000],vv[1000],vist[1000];
int main()
{
    int k,b,c,V,i,v,z;
    while(~scanf("%d%d",&V,&k))
    {
        memset(f,0,sizeof(f));
        memset(vist,0,sizeof(vist));
        for(i=1;i<=k;i++)
        {
          scanf("%d",&vv[i]);
          w[i]=vv[i];
        }
      for(i=1;i<=k;i++)
        for(v=0;v<=V;v++)
        {
           
            if(v<vv[i])
            f[i][v]=f[i-1][v];
            else
            f[i][v] = max(f[i-1][v-vv[i]] + w[i] , f[i-1][v])  ; 
        }
        int Max=0;
       for(i=1;i<=V;i++)       //找出最大价值 
            if(Max<f[k][i])
           {
               Max=f[k][i];
               z=i;
           }
       
        for(i=k;i>=1;i--)    //记录路径 
        {
            if(f[i][z]==f[i-1][z-vv[i]]+w[i])
            {
                vist[i]=1;
                z-=vv[i];
            }
            else    vist[i]=0;
            
        }
        for(i=1;i<=k;i++)
        {
            if(vist[i])
            printf("%d ",vv[i]);
        }
        printf("sum:%d\n",Max);
    }
    return 0;
}


 

 

  The Archeologists' Dilemma 

An archeologist seeking proof of the presence of extraterrestrials in the Earth's past, stumbles upon a partially destroyed wall containing strange chains of numbers. The left-hand part of these lines of digits is always intact, but unfortunately the right-hand one is often lost by erosion of the stone. However, she notices that all the numbers with all its digits intact are powers of 2, so that the hypothesis that all of them are powers of 2 is obvious. To reinforce her belief, she selects a list of numbers on which it is apparent that the number of legible digits is strictly smaller than the number of lost ones, and asks you to find the smallest power of 2 (if any) whose first digits coincide with those of the list.

Thus you must write a program such that given an integer, it determines (if it exists) the smallest exponent E such that the first digits of 2E coincide with the integer (remember that more than half of the digits are missing).

Input 

It is a set of lines with a positive integer N not bigger than 2147483648 in each of them.

Output 

For every one of these integers a line containing the smallest positive integer E such that the first digits of 2E are precisely the digits of N, or, if there is no one, the sentence ``no power of 2".

Sample Input 

1
2
10

Sample Output 

7
8
20

题意: 给你一个数字的前缀n ,这个数字只知道给的前缀,剩下部分丢失了,并且丢失的部分的长度比给的前缀大;而且这个数=2^e ; 求最下的e ;

比如第一组数据 ; 前缀为1,丢失的部分至少还有两位 ;所以这个数 1xx ,所以符合答案的是 2^7=128 ;所以最小的e=7符合 ;

做推倒 : 

   

所以 求的e在  log2(N)+人log2(10)  ~ log2(N+1)+人log2(10) 之间,其中人是丢失的部分的长度,(比前缀的长度达,至少len(N)+1 开始枚举) ;

log2(N)+人log2(10)  和  log2(N+1)+人log2(10) 之间相差不超过1 ; 所以 log2(N)+人log2(10) 向上取整就等于e ,log2(N+1)+人log2(10) 向下取整就等于e ,

两个都向下取整的话, 只有log2(N+1)+人log2(10)等于e ;

#include<cstdio>
#include<cmath>
const double log2_10 = log2(10.0);

int main(void)
{
	int n, m, i, tot, lower, upper;
	double t1, t2;
	while (~scanf("%d", &n))
	{
		t1 = log2(n), t2 = log2(n + 1);
		tot = 0;
		for (m = n; m; m /= 10)         //前缀的长度 
       			tot++;
		for (i = tot + 1;; ++i)         //人要大于前缀的长度;从tot+1开始枚举; 
		{
			lower = (int)(t1 + i * log2_10);    
			upper = (int)(t2 + i * log2_10);
			if (lower != upper)   //两个都向下取整,所以自然是不相等的 
			{
				printf("%d\n", upper);   //取upper 
				break;
			}
		}
	}
	return 0;
}


 

 



 

 

 

 

DC竞赛轴承故障检测训练赛是一项重要的赛事,旨在提高参赛者在轴承故障检测方面的技能和能力。轴承是现代机械设备的核心部件之一,其正常运转对于设备的性能和寿命都有着重要影响。 该训练赛主要分为两个部分,理论知识考核和实践操作。理论知识考核部分包括轴承的工作原理、常见故障模式、检测方法等内容。参赛者需要通过笔试形式回答相关问题,以展示他们对轴承故障检测知识的掌握程度。 实践操作部分是该训练赛的重点,参赛者将接受现场模拟操作任务。他们需要使用各种专业仪器和设备,对已安装在测试设备上的轴承进行全面的检测和评估。参赛者需要准确识别和定位轴承的故障类型,例如磨损、松动、疲劳等,并给出相应的处理建议。 此外,比赛中还将强调团队合作和沟通交流的重要性。参赛者将分为小组,共同完成任务,并在限定的时间内做出准确的判断和决策。 DC竞赛轴承故障检测训练赛意义重大。通过这项训练赛,可以提高参赛者的专业知识水平和实践操作能力,培养他们在轴承故障检测领域的创新能力和解决问题的能力。同时,这项比赛还有利于推动轴承故障检测技术的发展和应用,提高设备运维的质量和效率。 总之,DC竞赛轴承故障检测训练赛是一个重要的平台,对于推动轴承故障检测技术的普及和发展具有积极作用,也为参赛者提供了一个锻炼自身技能的机会。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值