更多解决方案 [英] More Solutions

查看:93
本文介绍了更多解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我被要求针对以下问题提交至少5个解决方案:


通过替换/添加或删除以下

代码段中的一个字符,让它打印ttttttttttttttttttttt(20次)

#include< stdio.h>


int main()

{

int k,j = 20;

for(k = 0; k< j; k--)

printf( " t);

printf(" \ n");

返回0;

}

我想出了3个解决方案,而不是(k = 0; k

2.而不是(k = 0; k

3.而不是for(k = 0; k

有谁可以建议我另外两个解决方案?

I was asked to submit atleast 5 solutions for the following problem:

By Replacing/Adding or deleting only one character from the following
code snippet, make it print tttttttttttttttttttt (20 times)

#include<stdio.h>

int main()
{
int k, j=20;
for(k=0;k<j;k--)
printf("t);
printf("\n");
return 0;
}

I came up with 3 solutions which were

1. instead of for(k=0;k<j;k--) write for(k=0;k<j;j--)

2. instead of for(k=0;k<j;k--) write for(k=0;-k<j;k--)

3.instead of for(k=0;k<j;k--) write for(k=0;k+j;k--)

Can anyone suggest me 2 more solutions?

推荐答案

Romram< sa ** *********@gmail.com>写道:
Romram <sa***********@gmail.com> wrote:
我被要求提交至少5个解决方案以解决以下问题:

通过替换/添加或删除以下
代码段中的一个字符, make it print tttttttttttttttttttt(20次)
#include< stdio.h>

int main()
{
int k,j = 20 ;
for(k = 0; k< j; k--)
printf(" t);
printf(" \ n");
返回0 ;
}


我假设您忘记了第一个printf()中的结束语。请确保您发布的代码实际上是正确的并且编译。

1.而不是for(k = 0; k< j; k--)写入(k = 0; k 2.而不是(k = 0; k
3. for(k = 0; k
任何人都可以建议我另外两个解决方案吗?
I was asked to submit atleast 5 solutions for the following problem:

By Replacing/Adding or deleting only one character from the following
code snippet, make it print tttttttttttttttttttt (20 times)

#include<stdio.h>

int main()
{
int k, j=20;
for(k=0;k<j;k--)
printf("t);
printf("\n");
return 0;
}
I assume you forget the closing quote in the first printf(). Please make
sure that the code you post actually is correct and compiles.
1. instead of for(k=0;k<j;k--) write for(k=0;k<j;j--)

2. instead of for(k=0;k<j;k--) write for(k=0;-k<j;k--)

3.instead of for(k=0;k<j;k--) write for(k=0;k+j;k--)

Can anyone suggest me 2 more solutions?




而不是for(k = 0; k
而不是for(k = 0; k

等等。如果这不是正确答案,那么问题

应该更准确。


-

:wq

^ X ^ Cy ^ K ^ X ^ C ^ C ^ C ^ C



instead of for(k=0;k<j;k--) write for(k=0;k<j;j-- )
instead of for(k=0;k<j;k--) write for(k=0;k<j;j-- )

et cetera. If this is not considered a correct answer, the question
should have been more precise.

--
:wq
^X^Cy^K^X^C^C^C^C


任何人都可以建议我另外两个解决方案吗?
Can anyone suggest me 2 more solutions?



而不是(k = 0; k 代替(k = 0; k
等等。如果这不是正确的答案,那么问题应该更准确。

-
:wq
^ X ^ Cy ^ K ^ X ^ C ^ C ^ C ^ C



instead of for(k=0;k<j;k--) write for(k=0;k<j;j-- )
instead of for(k=0;k<j;k--) write for(k=0;k<j;j-- )

et cetera. If this is not considered a correct answer, the question
should have been more precise.

--
:wq
^X^Cy^K^X^C^C^C^C




我的意思是5种不同或独特的解决方案。它现在是否清楚问题





I meant 5 different or unique solutions. Does it make the question
clear now?


Ico< us **** @ zevv.nl>写道:
Ico <us****@zevv.nl> wrote:
Romram< sa *********** @ gmail.com>写道:
Romram <sa***********@gmail.com> wrote:
我被要求提交至少5个解决方案以解决以下问题:

通过替换/添加或删除以下
代码段中的一个字符, make it print tttttttttttttttttttt(20次)
#include< stdio.h>

int main()
{
int k,j = 20 ;
for(k = 0; k< j; k--)
printf(" t);
printf(" \ n");
返回0 ;
}
I was asked to submit atleast 5 solutions for the following problem:

By Replacing/Adding or deleting only one character from the following
code snippet, make it print tttttttttttttttttttt (20 times)

#include<stdio.h>

int main()
{
int k, j=20;
for(k=0;k<j;k--)
printf("t);
printf("\n");
return 0;
}



我假设您忘记了第一个printf()中的结束语。请确保您发布的代码实际上是正确的并且编译。



I assume you forget the closing quote in the first printf(). Please make
sure that the code you post actually is correct and compiles.

1.而不是for(k = 0; k< j; k--)写入(k = 0; k 2.而不是(k = 0; k
3. for(k = 0; k
任何人都可以建议我另外两个解决方案吗?
1. instead of for(k=0;k<j;k--) write for(k=0;k<j;j--)

2. instead of for(k=0;k<j;k--) write for(k=0;-k<j;k--)

3.instead of for(k=0;k<j;k--) write for(k=0;k+j;k--)

Can anyone suggest me 2 more solutions?



而不是for(k = 0; k 而不是(k = 0; k



instead of for(k=0;k<j;k--) write for(k=0;k<j;j-- )
instead of for(k=0;k<j;k--) write for(k=0;k<j;j-- )




嗯,没有那些是错的,我改变了*和*插入,这是违反规则的
。在我输入之前我应该​​坐在我的手上。


-

:wq

^ X ^ Cy ^ K ^ X ^ C ^ C ^ C ^ C



Ehm, no those are wrong ofcourse, I changed *and* inserted, which is
against the rules. I should sit on my hands before I type.

--
:wq
^X^Cy^K^X^C^C^C^C


这篇关于更多解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆