zoukankan      html  css  js  c++  java
  • 在线笔试琐碎

    0. C

    #define EOF (-1)

    ~(-1) ⇒ 0

    int arr[1000005];           // C 语言中没有直接的动态数组,一维数组的大小需要预先声明,大小由问题的规模而定
    int n, int m;
    while (~scanf("%d, %d", &n, &m)) {
        for (int i = 0; i < n; ++i)
            scanf("%d", &arr[i]);
    }
                            while (scanf("%d, %d", &n, &m) != EOF);
                            ...

    1. C++ 输入输出示例

    //输入一组数据并输出 
    int a, b; 
    cin>> a >> b; 
    cout << a << b << endl; 
    
    //输入多组数据并输出 
    int a, b; 
    while(cin>> a >> b) 
         cout << a << b << endl;

    case 中第一个(n)表示有意义的输入,第二个(m)表示数组元素的个数,然后是 m 个数组元素:

    int n, m;
    vector<int> times;
    while (cin >> n >> m){
        for (int i = 0; i < m; ++i){
            int t;
            cin >> t;
            times.push_back(t);
        }
        // 对 vector 进行处理
        ...
    }

    2. Python 输入输出示例

    //输入一组数据并输出 
    str=raw_input()
    print str
    
    //输入多组数据并输出 
    import sys 
    for line in sys.stdin: 
        for value in line.split(): 
            print(value) 
  • 相关阅读:
    pg常用命令
    dmhs
    Redis集群
    Redis哨兵高可用架构
    Redis外网无法连接的问题
    Redis主从
    Redis持久化
    Redis安装
    Mysql执行计划详解
    Mysql安装配置
  • 原文地址:https://www.cnblogs.com/mtcnn/p/9423821.html
Copyright © 2011-2022 走看看