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) 
  • 相关阅读:
    动手动脑3
    AWK编程与应用
    BASH内置变量的使用
    服务器交互脚本expect
    编程对话框的界面程序
    每日打卡
    AppiumLibrary中文翻译
    Bootstrap4简单使用
    Python基础06-类与对象
    BDD模式-Python behave的简单使用
  • 原文地址:https://www.cnblogs.com/mtcnn/p/9423822.html
Copyright © 2011-2022 走看看