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) 
  • 相关阅读:
    Unity3D AssetBundle相关
    [转]Unity3D新手引导开发手记
    努力多彩
    js sendBeacon
    js document.activeElement及使用
    js requestAnimationFrame
    js 1+'2' == '1'+'2'
    js scrollIntoViewIfNeeded
    汉字 3个字节
    js 浅拷贝和深拷贝
  • 原文地址:https://www.cnblogs.com/mtcnn/p/9423822.html
Copyright © 2011-2022 走看看