#21011: 這題最快, 最厲害, 最短的解答


lj08197@stu.kcislk.ntpc.edu.tw (陳羿霏Marc Chen)


#include<iostream>
using namespace std;
int main()
{    
   string s;    
   while(cin >> s)       
 cout << "hello, "<< s << endl;    
}
 
#21790: Re:這題最快, 最厲害, 最短的解答


az.rejoice@gmail.com (Icy)


#include<iostream>
using namespace std;
int main()
{    
   string s;    
   while(cin >> s)       
 cout << "hello, "<< s << endl;    
}
 


 這題是單筆輸出,while 可以拿掉。

然後iostream沒有加優化程式的話很慢

可以加

ios_base::sync_with_stdio(false);

cin.tie(NULL);

或是用stdio

但我不想讓程式太長,就不使用了(反正測資非常少效率好不好不用去管)

把endl拿掉

然後如果要更短的話,using namespace std;拿掉

 

換行是不需要的

然後善用c++的rdbuf

最後可得

 

 

#include<iostream>

int main(){std::cout<<"hello, "<<std::cin.rdbuf();}

 

更短、更快

然後如果不限程式語言,python可以直接

print("hello,", input())

#22045: Re:這題最快, 最厲害, 最短的解答


753951852456 (精神小伙不請自來)


#include
using namespace std;
int main()
{    
   string s;    
   while(cin >> s)       
 cout << "F**K, "<< s << endl;    
}
 


 

 

#22093: Re:這題最快, 最厲害, 最短的解答


10851074 (JUJU IS CUTE)


#include
using namespace std;
int main()
{    
   string s;    
   while(cin >> s)       
 cout << "F**K, "<< s << endl;    
}
 


 

 


簡單