• 团体程序设计天梯赛 L1-051~L1~055


    L1-051

    思路:

    按规格输出即可

    代码:

    #include<bits/stdc++.h>
    
    using namespace std;
    
    int main() {
    	int x, y;
    	cin >> x >> y;
    	printf("%.2f", x * y * 0.1);
    	return 0;
    }
    

    L1-052

    思路:

    按要求输出即可

    代码:

    #include<bits/stdc++.h>
    
    using namespace std;
    
    int main() {
    	cout << 2018 << '
    ';
    	cout << "wo3 men2 yao4 ying2 !";
    	return 0;
    }
    

    L1-053

    思路:

    加起来输出即可

    代码:

    #include<bits/stdc++.h>
    
    using namespace std;
    
    int main() {
    	string s = "Wang!";
    	int a, b;
    	cin >> a >> b;
    	while(a--) cout << s;
    	while(b--) cout << s;
    	return 0;
    }
    

    L1-054

    思路:

    上下左右倒过来输出即可

    代码:

    #include<bits/stdc++.h>
    
    using namespace std;
    
    int main() {
    #ifdef MyTest
    	freopen("Sakura.txt", "r", stdin);
    #endif	
    	char c;
    	int n;
    	scanf("%c %d", &c, &n); getchar();
    	vector<string> a(n), b(n);
    	for(int i = 0; i < n; i++){
    		getline(cin, a[i]);
    		while(a[i].length() != n) a[i] += ' ';
    	} 
    	bool flag = true;
    	for(int i = 0; i < n; i++){
    		b[i] = a[n - i - 1];
    		reverse(b[i].begin(), b[i].end());
    		if(b[i] != a[i]) flag = false;
    	}
    	if(flag) puts("bu yong dao le");
    	for(string & s : b){
    		for(char & x : s){
    			if(x == '@') putchar(c);
    			else putchar(' ');
    		}
    		putchar('
    ');
    	}
    	return 0;
    }
    

    L1-055

    思路:

    简单判断下即可

    代码:

    #include<bits/stdc++.h>
    
    using namespace std;
    
    int main() {
    	int x, y, a, b, c;
    	cin >> x >> y >> a >> b >> c;
    	if( x > y && (!a || !b || !c) ) printf("The winner is %c: %d + %d", 'a', x, 3 - a - b - c);
    	else printf("The winner is %c: %d + %d", 'b', y, a + b + c);
    	return 0;
    }
    
  • 相关阅读:
    eval函数欺负我
    JS Compress and Decompress
    PowerDesigner 把Comment写到name中 和把name写到Comment中 pd7以后版本可用
    vue + axios 通过Blob 转换excel文件流 下载乱码问题
    poj 3687Labeling Balls
    poj 2485Highways
    poj 1258AgriNet
    poj 3041Asteroids
    poj 1035Spell checker
    poj 3020Antenna Placement
  • 原文地址:https://www.cnblogs.com/yuhan-blog/p/12308673.html
Copyright © 2020-2023  润新知