刷题笔记-牛客网&leetcode

c++和python处理读入数据:
c++:

#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
vector<string> s;
string temp;
while(cin>>temp)
{
    s.push_back(temp);
}

python:

list1 = list(map(str,input().split()))
如果是输入两个数字,想要将其分割,可以这么写:
n, m = [int(x) for x in input().split()]

python的if not用法:

if not x: #如果nums是空,not nums就是真,就会执行下面的print语句
	print(x)
#与之类似的还有:
if x is not None:

猜你喜欢

转载自blog.csdn.net/aaon22357/article/details/83051500