• A - Penalty Kick


    A - Penalty Kick

    我又又又回来啦

    题目:

    Problem Statement

    Takahashi will have N N N penalty kicks in a soccer match.

    For the i i i-the enalty kick, he will fail if i i i is a multiple of 3 3 3, and succeed otherwise . . .

    Print the results of his penalty kicks . . .

    Constraints

    • 1 ≤ N ≤ 100 1 \leq N \leq 100 1N100
    • All inputs are integers . . .

    Input

    The input is given from Standard Input in the following format : : :

    N
    
    • 1

    Output

    Print a string of length N N N representing the results of Takahashi’s penalty kicks. The i i i-th character ( 1 ≤ i ≤ N ) (1 \leq i \leq N) (1iN) should be o if Takahashi succeeds in the i i i-th penalty kick , , , and x if he fails . . .

    输入输出
    很好,思路:

    先输入 N N N, f o r for for循环看看当前i是不是 3 3 3的倍数 , , ,如是 , , ,输出o , , ,否则输出x . . .

    ACcode:

    //コード通過,by zhimajiazhu0316。コピー/復制/商用禁止です。
    #include 		// 基本入出力ストリーム
    #include 	// 一般的なアルゴリズム(ソート、ルックアップ、やり直し、二分ルックアップなど)
    #include 		// 動的配列(スペースが足りないと自動的に拡張されます)
    #include 		//  スタック(先に入って先に出ます)
    #include 		// スタック(先に入ってから出ます)
    #include 			// 集合(反復しない順序)です
    #include 			// キー値対コンテナ(マッピング)
    #include 			//  両方向リスト
    #include 		//  すうがくかんすう
    #include 	// 通用的函数绑定和调用机制一般的なバインディングと呼び出しの仕組み
    
    #define endl '\n'
    #define pii pair<int, int>
    #define pdd pair<double, double>
    #define fi first
    #define se second
    #define pb push_back
    #define eb emplace_back
    
    using namespace std;
    
    const int inf = 1e9 + 7;
    const int mod = 998244353;
    const int N = 2e5 + 10, M = N << 1;
    
    void solve(){
        // 竞赛程序
        int n;
        cin>>n;
        for(int i=1;i<=n;i++){
        	if(i%3==0){
        		cout<<"x";
    		}
    		else{
    			cout<<"o";
    		}
    	}
    }
    
    signed main(){
    
        ios::sync_with_stdio(0);
        cin.tie(0); cout.tie(0);
    
        int t = 1;
    //	cin >> t;	// 非多组测试数据请注释该行
        while(t--) solve();
        return 0;
    }
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51

    okk今天就到这吧

  • 相关阅读:
    2M大小windows11 改 windows10
    k8s之Deployment
    【SSM进阶学习系列丨整合篇】Spring+SpringMVC+MyBatis 框架配置详解
    FPGA project : ROM_VGA
    Java中的容器(二) 双例集合
    Idea创建JavaEE项目
    【C++】日期类的实现
    MySQL 啥时候用表锁,啥时候用行锁?这些你都应该知道吧
    Linux C语言基础 day10
    【无标题】
  • 原文地址:https://blog.csdn.net/qianzhima2012/article/details/137438218