zoukankan      html  css  js  c++  java
  • 团体程序设计天梯赛 L1-036~L1-040

    L1-036

    思路:

    相乘输出即可

    代码:

    #include<bits/stdc++.h>
    
    using namespace std;
    
    int main() {
    	int a, b;
    	cin >> a >> b;
    	cout << a * b;
    	return 0;
    }
    

    L1-037

    思路:

    按格式输出即可

    代码:

    #include<bits/stdc++.h>
    
    using namespace std;
    
    int main() {
    	int a, b;
    	cin >> a >> b;
    	printf("%d/", a);
    	if(b < 0) printf("(%d)=", b);
    	else printf("%d=", b);
    	if(b){	printf("%.2f", a * 1.0 / b); }
    	else puts("Error");
    	return 0;
    }
    

    L1-038

    思路:

    输出即可

    代码:

    #include<bits/stdc++.h>
    
    using namespace std;
    
    int main() {
    	puts("Hello World");
    	puts("Hello New World");
    	return 0;
    }
    

    L1-039

    思路:

    稍微找一下规律,输出即可

    代码:

    #include<bits/stdc++.h>
    
    using namespace std;
    
    int main() {
    	int n; cin >> n; getchar();
    	string s; getline(cin, s);
    	int len = s.length(), pos = len - 1;
    	while(pos % n) --pos;
    	for(int i = 0; i < n; i++){
    		for(int st = pos++; st >= 0; st -= n)
    			putchar(st < len ? s[st] : ' ');
    		putchar('
    ');
    	}
    	return 0;
    }
    

    L1-040

    思路:

    判断相乘或者相除
    找一个161的女朋友有没

    代码:

    #include<bits/stdc++.h>
    
    using namespace std;
    
    int main() {
    	int kase;
    	cin >> kase;
    	while(kase--){
    		char c;
    		double h;
    		cin >> c >> h;
    		if(c == 'M') printf("%.2f
    ", h / 1.09);
    		else printf("%.2f
    ", h * 1.09);
    	}
    	return 0;
    }
    
  • 相关阅读:
    核新同花顺数据结构
    python发送各类邮件的主要方法
    Tesseract-OCR引擎 入门
    ruby函数回调的实现方法
    软件单元测试之我见
    cocos cteator中tiled模式 用图集容易出线
    入坑CCC遇到的一些坑啊
    关于委托的理解
    火狐浏览器的三个坑
    抗锯齿的BUG
  • 原文地址:https://www.cnblogs.com/yuhan-blog/p/12308677.html
Copyright © 2011-2022 走看看