NP5. 格式化输出(一)
描述
输入描述
一行一个字符串表示名字。输出描述
示例1
输入:
Niuniu
输出:
I am Niuniu and I am studying Python in Nowcoder!
C 解法, 执行用时: 2ms, 内存消耗: 280KB, 提交时间: 2022-05-26
#include<stdio.h> int main(){ char a[100]; gets(a); printf("I am %s and I am studying Python in Nowcoder!",a); }
C 解法, 执行用时: 2ms, 内存消耗: 332KB, 提交时间: 2022-05-25
#include<stdio.h> int main() { char arr[100]; gets(arr); printf("I am %s and I am studying Python in Nowcoder!",arr); return 0; }
C++ 解法, 执行用时: 3ms, 内存消耗: 284KB, 提交时间: 2022-05-26
#include <iostream> using namespace std; #include <string> int main() { string s; while(getline(cin, s)){ string s1 = "I am " + s + " and I am studying Python in Nowcoder!" ; cout << s1<< endl; } return 0; }
Python 解法, 执行用时: 10ms, 内存消耗: 2864KB, 提交时间: 2022-06-14
# name = input() # print("I am %s and I am studying Python in Nowcoder!"%name) name=raw_input() print('I am %s and I am studying Python in Nowcoder!' %name)
Python 解法, 执行用时: 10ms, 内存消耗: 2944KB, 提交时间: 2022-07-25
# name = input() # print("I am %s and I am studying Python in Nowcoder!"%name) str = raw_input() print('I am %s and I am studying Python in Nowcoder!' %str)