ACM Block world Time Limit:1000ms Memory Limit:65536kb Descr

zyh63190192022-10-04 11:39:541条回答

ACM Block world Time Limit:1000ms Memory Limit:65536kb Description Many areas of Computer Science

已提交,审核后显示!提交回复

共1条回复
青苹-果 共回答了17个问题 | 采纳率88.2%
计算机积木世界时间限制:1000ms内存限制:65536kb描述计算机科学的许多领域
1年前

相关推荐

ACM的 “顺”序列 Time Limit:1000MS Memory Limit:32768K
ACM的 “顺”序列 Time Limit:1000MS Memory Limit:32768K
Description:
贝贝5岁了.她从一堆数字卡片中选出了4张卡片:5、7、6、8.她摆布了一阵这些卡片后,发现它们可以排成比较顺的序列:5、6、7、8.她同样拿了另4张卡片:5、7、1、2,可是怎么也排不成“顺”的序列.原来,贝贝的所谓“顺”序列是我们所知道的等差数列!贝贝一边拿起一堆数字卡片,一边就在摆布它们,尝试着让它们“顺”起来,可总是有些“顺”,有些不“顺”.这个问题得靠你给她帮忙了,设计一个程序,能够判断对于给定的一堆数字,能“顺”还是不能“顺”.
Input:
输入中第一行为一个整数n(1≤n≤10),描述后面一共有n组卡片,每组卡片的第一个数m(1≤m≤100),表示后面会出现m张卡片.
Output:
针对每组卡片,判断是否能构成“顺”序列.如果能构成“顺”序列,则输出“yes”,否则就输出“no”.每个结果应分别不同行显示.
Sample Input:
2
4 5 7 6 8
8 1 7 3 2 8 12 78 3
Sample Output:
yes
no
————————————————————————————
下面是我写的代码:
#include
using namespace std;
void bb(int *p,int size) //冒泡排序
{
int i,temp,k=1;
for(int pass=1;pass>n)
{
int i,j;
cin>>m;
for(i=0;ia[i][j];
for(i=0;i
吴清源1年前1
假装偶然 共回答了14个问题 | 采纳率78.6%
#include
using namespace std;
#include
bool isorder(int* a, int m)
{
sort(a,a+m);
int t = a[1]-a[0];
for(int i=3;i>n;
for(int i=0;i>m;
for(int j=0;j>a[j];
r[i] = m
A+B Problem Time Limit:1000MS Memory Limit:1024K Description
A+B Problem Time Limit:1000MS Memory Limit:1024K Description:Calculate a + b Input:The input will
For each pair of input integers a and b you should output the sum of a and b in one line,and with one line of output for each line in input.
Sample Input:
1 5
0 0
Sample Output:
6
刚刚学习ACM第一题就错了麻烦大家帮帮忙了
我的代码是这个
#include
using namespace std;
int main(int argc,char* argv[])
{
int a,b;
while(cin >> a >> b)
cout a >> b)
cout
我爱歪歪啊1年前1
孤独行星x 共回答了20个问题 | 采纳率90%
#include
using namespace std;
int main()
{
int a,b;
while (cin >> a >> b) {
if (a == 0 && b == 0)
return 1;
else
cout
英语翻译Uniform GeneratorTime Limit:1000MS Memory Limit:10000KTo
英语翻译
Uniform Generator
Time Limit:1000MS Memory Limit:10000K
Total Submissions:4115 Accepted:1950
Description
Computer simulations often require random numbers.One way to generate pseudo-random numbers is via a function of the form
seed(x+1) = [ seed(x) + STEP ] % MOD
where "%" is the modulus operator.
Such a function will generate pseudo-random numbers (seed) between 0 and MOD-1.One problem with functions of this form is that they will always generate the same pattern over and over.In order to minimize this effect,selecting the STEP and MOD values carefully can result in a uniform distribution of all values between (and including) 0 and MOD-1.
For example,if STEP=3 and MOD=5,the function will generate the series of pseudo-random numbers 0,3,1,4,2 in a repeating cycle.In this example,all of the numbers between and including 0 and MOD-1 will be generated every MOD iterations of the function.Note that by the nature of the function to generate the same seed(x+1) every time seed(x) occurs means that if a function will generate all the numbers between 0 and MOD-1,it will generate pseudo-random numbers uniformly with every MOD iterations.
If STEP = 15 and MOD = 20,the function generates the series 0,15,10,5 (or any other repeating series if the initial seed is other than 0).This is a poor selection of STEP and MOD because no initial seed will generate all of the numbers from 0 and MOD-1.
Your program will determine if choices of STEP and MOD will generate a uniform distribution of pseudo-random numbers.
Input
Each line of input will contain a pair of integers for STEP and MOD in that order (1
鸭鸭19811年前2
opiumismh 共回答了30个问题 | 采纳率96.7%
制服发电机
期限:1000MS极限:10000K记忆
总递交:4115接受:1950年
描述
计算机仿真结果往往需要随意数.一个方法是通过产生伪随机数字之间的函数形式
种子(x + 1)=[种子(x)+一步]%的模板
在“%”是模数运算符.
此功能将会产生伪随机编号(种子)介于0和MOD-1.有问题的功能的形式是叫他们永远产生同样的模式.为了尽量减少这种效果,选择步骤、国防部价值观仔细可以导致之间的均匀分布,包括所有值(0和MOD-1).
例如,如果一步= 3、国防部= 5,该函数将产生一系列的伪随机编号0、3、1号,4号,2个在一个不断重复周期.在这个例子中,所有的数字,包括0和MOD-1之间会产生每MOD次迭代的功能.注意,大自然的功能来产生相同的种子(x + 1)每次种子(x)发生意味着如果一个函数将产生所有编号介于0和MOD-1,它将产生伪随机编号一致与每个插件迭代.
如果步骤15例、国防部= 20,函数产生的系列0、15、10、5(或者任何其他如果初始种子重复系列除了0).这是一个贫穷的一步选择、国防部因为最初没有种子将产生所有的数量从0和MOD-1.
如果你的程序的选择将决定步骤、国防部将会产生一个均匀分布的伪随机编号.
输入
每一行输入将会包含一个对整数步、国防部按照这个顺序(1 < < = =一步,MOD 100000).
输出
在每一行输入,你的程序应该打印了一份价值right-justified步骤1至10日在列纵队right-justified国防部价值,或者11通过20个“好”或“坏的选择,选择“left-justified开始于柱25.“好选择”的信息应该被打印时的选择、国防部将产生所有步骤,包括数字0和MOD-1之间产生当国防部数字.否则,你的程序应该打印信息“坏的选择.”每个输出的测试集之后,你的程序应该准确印刷只留下一行.
ACM的 “顺”序列 Time Limit:1000MS Memory Limit:32768K
ACM的 “顺”序列 Time Limit:1000MS Memory Limit:32768K
Description:
贝贝5岁了.她从一堆数字卡片中选出了4张卡片:5、7、6、8.她摆布了一阵这些卡片后,发现它们可以排成比较顺的序列:5、6、7、8.她同样拿了另4张卡片:5、7、1、2,可是怎么也排不成“顺”的序列.原来,贝贝的所谓“顺”序列是我们所知道的等差数列!贝贝一边拿起一堆数字卡片,一边就在摆布它们,尝试着让它们“顺”起来,可总是有些“顺”,有些不“顺”.这个问题得靠你给她帮忙了,设计一个程序,能够判断对于给定的一堆数字,能“顺”还是不能“顺”.
Input:
输入中第一行为一个整数n(1≤n≤10),描述后面一共有n组卡片,每组卡片的第一个数m(1≤m≤100),表示后面会出现m张卡片.
Output:
针对每组卡片,判断是否能构成“顺”序列.如果能构成“顺”序列,则输出“yes”,否则就输出“no”.每个结果应分别不同行显示.
Sample Input:
2
4 5 7 6 8
8 1 7 3 2 8 12 78 3
Sample Output:
yes
no
————————————————————————————
下面是我写的代码:
#include
using namespace std;
void bb(int *p,int size) //冒泡排序
{
int i,temp,k=1;
for(int pass=1;pass>n)
{
int i,j;
cin>>m;
for(i=0;ia[i][j];
for(i=0;i
jianke_4681年前1
cmtcmt 共回答了22个问题 | 采纳率86.4%
经过测试,Time(MS) 15 Memory(K) 172 Length 806 Language VC
编译器运行通过,不知道它为什么提示Wrong Answer
#include
using namespace std;
void sort(int *seq,int m) //冒泡排序
{
int *p;
int temp,i;
for(i=m;i>=2;i--)
{
for(p=seq;p*(p+1))
{
temp=*p;
*p=*(p+1);
*(p+1)=temp;
}
}
}
}
void main()
{
int m,n;
int **a;
int *flag;
int *p,**pp;
while(cin>>n)
{
a=(int **)calloc(n,sizeof(int*));
flag=(int*)calloc(n,sizeof(int));
for(pp=a;pp>m;
*pp=(int*)calloc(m,sizeof(int));
memset(*pp,0,m);
for(p=*pp;p>*p;
}

sort(*pp,m);
for(p=*pp+1;p
新手请教ACM水题Q - 数据的交换输出Time Limit:1000MS Memory Limit:32768KB 6
新手请教ACM水题
Q - 数据的交换输出
Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u
Submit Status
Description
输入n(n>n)
x09{
x09x09if(n==0)continue;
x09x09for(i=1;i>m;
x09x09x09x[i-1]=m;
x09x09x09if(i==1)min=x[0];
x09x09x09if(x[i-1]
tandy88581年前1
明月残风流水 共回答了25个问题 | 采纳率88%
嘿嘿,我第一次水题的时候,就第一到题目我交了12次.
我和你说下在你逻辑正确的情况下,一些问题:1.你要注意换行 2.你要注意这个是不是进行无线循环的 3.注意空格之类的 4.有些情况是不需要的return 0 的
这道题求oj题超时,求简单算法划分方法Time Limit:1000MS Memory Limit:65536KTota
这道题求oj题超时,求简单算法
划分方法
Time Limit:1000MS Memory Limit:65536K
Total Submit:105 Accepted:30
Description
我们知道: 15=7+8=4+5+6=1+2+3+4+5 , 这里有3中分割方法, 记 dw(15)=3.
把n分成一些连续的正整数和的方法数称为dw(n)
Input
多组测试数据,每组一个int型的n(n>0)
Output
输出dw(n)
Sample Input
13
15
Sample Output
1
3
Source
军哥
我写的代码:
#include
using namespace std;
int fun(int n)
{
int sum=0,i,j;
for(i=1;in)
cout
lin9927271年前1
wizardgbb 共回答了18个问题 | 采纳率83.3%
#include
#include
using namespace std;
int fun(int n)
{
int sum=0,i,j,m;
m = (-1 + sqrt(1.0+(n
ACM水题,WA了,请问错在哪里了?对称文 Time Limit:1000MS Memory Limit:32768KD
ACM水题,WA了,
请问错在哪里了?
对称文
Time Limit:1000MS Memory Limit:32768K
Description:
所谓对称文是字符串以中心为对称.例如,madam是对称文.字串中的字符是由数字、标点符号、空格以及英文字符(包括大小写)组成.每个字串占一行.英文字符不区分大小写,也就是说,’A’与’a’视同相等.标点符号中“{}”对称.除此之外,当字串为“000000”时,输入结束.
Sample Input:
ling 121 gnil
kkghkkhg
)aba(
000000
Sample Output:
Symmetry
Symmetry
Not symmetry
Not symmetry
# include
# include
int main(void)
{
x05char s[1000];
x05int i,j,n;
x05while(gets(s))
x05{
x05x05if(strcmp(s,"000000")==0)
x05x05x05break;
x05x05for(i=0;s[i]!=' ';i++)
x05x05x05if(s[i]>='A'&&s[i]
小俪1年前1
王向农 共回答了11个问题 | 采纳率81.8%
你判断标点符号的时候少考虑了一种情况.题目里可没有说""的前面,其他标点符号也一样.我觉得你的程序连测试样例里的")abc("都会判断错误吧.目前就发现这一个问题,你修改一下试试,有其他问题我们再交流.
C++编程求和Problem D:求和Time Limit:1000MS Memory Limit:65536KTota
C++编程求和
Problem D:求和
Time Limit:1000MS Memory Limit:65536K
Total Submit:38 Accepted:5
Description
简单的a+b问题,对我们而言已不在话下,现在尝试尝试新型求和吧:
给定一个正整数,求这个整数的各个位数数值之和.
Input
输入有多组测试数据,每组测试数据包含一个正整数n(1
huangw190051年前1
我真是孟广美 共回答了12个问题 | 采纳率91.7%
//
#include
int main()
{
int n,num;
while(scanf("%d",&n)&&n!=0) //输入0 退出循环
{
x09num=0;
x09while(n) // 累加各位数字
x09{
x09 x09num+=n%10;
x09 x09n/=10;
x09 }
x09 printf("%dn",num) ;
}
}
一道acm题,Delete NumberTime Limit:1000MS Memory Limit:65536KTot
一道acm题,
Delete Number
Time Limit:1000MS Memory Limit:65536K
Total Submit:701 Accepted:129
Description
Given 2 integer number n and m.You can delete m digits from the number n,then number n changes to a new number n1.Tell me how to delete the number,you can get the smallest one.
For example,
m:1 n:1456
n1 may be 145,156,146,456
the smallest one is 145.Then n1 should be 145.
Input
The input consists of T test cases.The number of them (T) is given on the first line of the input file.Each test case consists of one single line containing two integer number m(1
wxjzh1年前1
其实都一样123456 共回答了18个问题 | 采纳率94.4%
1
2 178023
if (*(p-1)>*p&&n>0)
{
del (p-1);
n--;
}
……
if (*(p-1)>*p&&n>0)
{
del (p-1);
n--;
p=str+1;
}
不知道题目在那~没有测试~
pascal初学者提问[j9]最经济型包装箱型号Time Limit:1000MS Memory Limit:65536
pascal初学者提问
[j9]最经济型包装箱型号
Time Limit:1000MS Memory Limit:65536K
Total Submit:32 Accepted:23
Description
已知有A,B,C,D,E五种包装箱,为了不浪费材料,小于10公斤的用A型,大于等于10公斤小于20公斤的用B型,大于等于20公斤小于40公斤的用C型,大于等于40公斤的小于50公斤的用D型,大于等于50公斤小于80公斤的用E型.现在输入一货物的重量(小于80公斤),找出最经济型的包装箱型号.
Input
输入只有一行,包括一个整数.
Output
输出只有一行(这意味着末尾有一个回车符号),包括1个字符.
Sample Input
8
Sample Output
A
Source
LQ-SUN1年前1
咒oo装怪的老女人 共回答了14个问题 | 采纳率85.7%
program j9;
var a:integer;
begin
readln(a); {读入重量}
if a
请高手翻译一下Financial ManagementTime Limit: 1000MS Memory Limit:
请高手翻译一下
Financial Management
Time Limit: 1000MS Memory Limit: 10000K
Total Submissions: 42448 Accepted: 20746
Description
Larry graduated this year and finally has a job. He's making a lot of money, but somehow never seems to have enough. Larry has decided that he needs to grab hold of his financial portfolio and solve his financing problems. The first step is to figure out what's been going on with his money. Larry has his bank account statements and wants to see how much money he has. Help Larry by writing a program to take his closing balance from each of the past twelve months and calculate his average account balance.
Input
The input will be twelve lines. Each line will contain the closing balance of his bank account for a particular month. Each number will be positive and displayed to the penny. No dollar sign will be included.
Output
The output will be a single number, the average (mean) of the closing balances for the twelve months. It will be rounded to the nearest penny, preceded immediately by a dollar sign, and followed by the end-of-line. There will be no other spaces or characters in the output.
环境与我1年前1
pangin 共回答了19个问题 | 采纳率78.9%
财务管理
时间限制:1000MS内存限制:10000K
共计提交:42448接受:20746
说明
拉里毕业,今年终于有了一份工作.他作出了很多钱,但不知似乎永远不会有足够的.拉里已经决定,他需要掌握他的金融投资组合和解决他的融资问题.第一步是找出有什么一直在与他的钱.拉里了他的银行帐户报表和希望看到多少钱他.帮助拉里写一个程序把他期末余额分别来自过去12个月,并计算其平均帐户余额.
输入
输入将12行.每一行都将包含期末余额的银行帐户进行特定的月份.每个数字将是积极的,并显示给一分钱.没有货币符号将包括在内.
输出
输出将是一个单一号码,平均(平均)的期末余额为12个月.这将是四舍五入至最接近的一分钱,在此之前立即一个美元符号,并遵循的行尾.将不会有其他空格或字符输出.
A+B acm出现的问题A+B Problem Time Limit:1000MS Memory Limit:1024K
A+B acm出现的问题
A+B Problem
Time Limit:1000MS Memory Limit:1024K
Description:
Calculate a + b
Input:
The input will consist of a series of pairs of integers a and b,separated by a space,one pair of integers per line,0 0 means the end of the input,and do not need to output.
Output:
For each pair of input integers a and b you should output the sum of a and b in one line,and with one line of output for each line in input.
Sample Input:
1 5
0 0
Sample Output:
6
刚刚学习ACM第一题就错了麻烦大家帮帮忙了
我的代码是这个
#include
using namespace std;
int main(int argc,char* argv[])
{
int a,b;
while(cin >> a >> b)
cout a >> b)
cout
xiaoliao71201年前1
Posion__ 共回答了13个问题 | 采纳率84.6%
#include
using namespace std;
int main(int argc, char* argv[])
{
int a, b;
while(cin >> a >> b,a!=0&&b!=0)//加上这句

cout
一道acm题,Problem H:Groups (I)Time Limit:1000MS Memory Limit:65
一道acm题,
Problem H:Groups (I)
Time Limit:1000MS Memory Limit:65536K
Total Submit:93 Accepted:31
Description
  There are n people in the class and
person pi has his value vi.Now,we'd like to put them into different groups.In
each group,there must be two people,and the value of this group is equal to
the minimum of two member's values.For example,if pi and pj are in the same
group,the value of their group is min(pi,pj).Now,your task is to tell the
maximum and minimum of the sum of all groups.
Input
  There are several test cases.
  In
each case,there is an even integer n(n
uu天使tracy1年前1
flyinglee 共回答了16个问题 | 采纳率81.3%
个人感觉,可以先排序.那么最大的情况就是相邻两个组成一个pair,最小的情况就是首尾组成一个pair.例如,input:1 2 3 4 5 6 7 8 9 10.最大的情况就是(1 2)(3 4)(5 6)(7 8)(9 10),最小的情况就是(1 10)(2 9)(3 8)(4 7)(5 6).当然,最小的情况还有很多种排法,只要保证是最小的5个数输出就行,例如(1 6)(2 7)(3 8)(4 9)(5 10)也是可以的
计算题 Time Limit: 1000MS Memory limit: 65536K
计算题 Time Limit: 1000MS Memory limit: 65536K
题目描述
一个简单的计算,你需要计算f(m,n),其定义如下:
当m=1时,f(m,n)=n;
当n=1时,f(m,n)=m;
当m>1,n>1时,f(m,n)= f(m-1,n)+ f(m,n-1)
输入
第一行包含一个整数T(1
漂泊的兔子1年前1
心灵漫步2 共回答了16个问题 | 采纳率87.5%
打表就行了,肯定不会TLE.
#include
const int MAXN = 2001;
const int MAXM = 2001;
int f[MAXN][MAXM];
int main()
{
int i,j ;
for( i = 0 ; i < MAXN ; i++ )
{
f[1][i] = f[i][1] = i;
}
for( i = 2 ; i < MAXN ; i++ )
{
for( j = 2; j < MAXM; j++ )
{
f[i][j] = f[i-1][j] + f[i][j-1];
}
}
int n;
while( scanf("%d",&n)!=EOF)
{
int a,b;
while(n-- && scanf("%d%d",&a,&b) )
printf("%dn",f[a][b]);
}
return 0;
}
ACM题 英雄联盟 Time Limit:1000MS Memory Limit:32768KDescription:T
ACM题
英雄联盟
Time Limit:1000MS Memory Limit:32768K
Description:
There's a game called League of Legends.It's a game like DotA.
Now you have a simple task - Draw an icon of "League of Legends" by character.
The icon is like that:

You should draw a border(N * N,N is length of a side) that is width 1 and leave a space inside.Then you should draw an"L".
Input:
This problem has several cases.Input until EOF.Each case include a character and an integer N(7
wehwethtrht1年前1
Rick1213 共回答了18个问题 | 采纳率94.4%
问题都给你解决了,也点赞同了,怎么就不采纳?
#include
int main()
{
int i, j, n;
char ch;
while (scanf("%c %d", &ch, &n) != EOF)
{
for (i = 0; i < n; i++)
{
for (j = 0; j < n; j++)
{
if (i == 0 || i == n - 1)
{
printf("%c", ch);
}
else if (i == n - 3 && j != 1 && j != n - 2)
{
printf("%c", ch);
}
else if (i != 1 && i != n - 2 && (j == 0 || j == 2 || j == n - 1))
{
printf("%c", ch);
}
else if ((i == 1 || i == n - 2) && (j == 0 || j == n - 1))
{
printf("%c", ch);
}
else
{
printf(" ");
}
}
printf("n");
}
}
return 0;
}
你能帮我改改这个题吗?Problem A:CountingTime Limit:1000MS Memory Limit:
你能帮我改改这个题吗?
Problem A:Counting
Time Limit:1000MS Memory Limit:65536K
Total Submit:14 Accepted:12
Description
一本书的页码从自然数1 开始顺序编码直到自然数n.书的页码按照通常的习惯编排,每个页码都不含多余的前导数字0.例如,第6 页用数字6 表示,而不是06 或006 等.数字计数问题要求对给定书的总页码n,计算出书的全部页码中分别用到多少次数字0,1,2,…,9.
编程任务:
给定表示书的总页码的10 进制整数n (1≤n≤10000) .计算书的全部页码中分别用到多少次数字0,1,2,…,9.
Input
输入由多组测试数据组成.
每组测试数据输入只有1 行,给出表示书的总页码的整数n.
Output
对应每组输入,输出共有10行,在第k行输出页码中用到数字k-1 的次数,k=1,2,…,10.
Sample Input
11
Sample Output
1
4
1
1
1
1
1
1
1
1
代码是
#include
main()
{ char str[5];
x05int n,i,j,m,a,b,c,d,e,f,g,h,k,l;
x05while(scanf("%d",&n)!=EOF){
x05x05a=b=c=d=e=f=g=h=k=l=0;
x05x05for(i=1;i
1214175131年前1
semon55 共回答了9个问题 | 采纳率88.9%
求oj链接.
另外你为啥不用数组?定义那么多变量.
直接一个c[10]数组就搞定了.
另外别一道题发多次哈.