YLCZ4月月赛

网址YLCZ比赛界面

密码:ylcz0101

A

#include<iostream>
using namespace std;
int n;
int main() {
	cin >> n;
    cout << 3 * n;
    return 0;
}

B

#include<iostream>
using namespace std;
int n;
int main() {
	cin >> n;
    if(n <= 100){
        cout << n * 2;
    }
    else{
        cout << 200 + (n - 100);
    }
    return 0;
}

C

#include<iostream>
using namespace std;
char f(int x, int y){
    if(x + y < 10){
        return char(x + y + 'A');
    }
    else{
        cout << "B";
        return char(x + y - 10 + 'A');
    }
}
int main(){
    char a, b;
    int x, y;
    cin >> a >> b;
    x = a - 'A';
    y = b - 'A';
    cout << f(x, y);
    return 0;
}

D

#include<iostream>
#include<cmath>
using namespace std;
int main(){
    int a, b;
    cin >> a >> b;
    if(pow(a, b) == pow(b, a)){
        cout << "same";
    }
    else if(pow(a, b) < pow(b, a)){
        cout << "second";
    }
    else {
        cout << "first";
    }
    return 0;
}

E

#include<iostream>
using namespace std;
string s;
int n, m;
int main(){
    cin >> s;
    cin >> n >> m;
    int cnt = n - 1;
    for(int i = 1;i <= m;i++){
        if(cnt == s.size() - 1){
            cout << s[cnt];
            cnt = 0;
        }
        else{
            cout << s[cnt++];
        }
    }
    return 0;
}

F

#include<iostream>
using namespace std;
int n, sum = 0;
char a[33][33];
bool f[33][33];
int main(){
    cin >> n;
    for(int i = 1;i <= n;i++){
        for(int j = 1;j <= n;j++){
            cin >> a[i][j];
        }
    }
    for(int i = 1;i <= n;i++){
    	for(int j = 1;j <= n;j++){
    		if(a[i][j] == '*'){
                f[i][j] = true;
                sum += 1;
                for(int k = 1;k + i <= n;k++){
                    if(a[k + i][j] == '.'){
                    	if(!f[k + i][j]){
                    		f[k + i][j] = true;
                        	sum++;
						}
                    }
                    else{
                        break;
                    }
                }
                for(int k = 1;i - k >= 1;k++){
                    if(a[i - k][j] == '.'){
                        if(!f[i - k][j]){
                    		f[i - k][j] = true;
                        	sum++;
						}
                    }
                    else{
                        break;
                    }
                }
                for(int k = 1;k + j <= n;k++){
                    if(a[i][j + k] == '.'){
                        if(!f[i][j + k]){
                    		f[i][j + k] = true;
                        	sum++;
						}
                    }
                    else{
                        break;
                    }
                }
                for(int k = 1;j - k >= 1;k++){
                    if(a[i][j - k] == '.'){
                        if(!f[i][j - k]){
                    		f[i][j - k] = true;
                        	sum++;
						}
                    }
                    else{
                        break;
                    }
                }
            }
		}
	}
//	for(int i = 1;i <= n;i++){
//		for(int j = 1;j <= n;j++){
//			cout << a[i][j] << " " << f[i][j] << " ";
//		}
//		cout << endl;
//	}
    cout << sum;
    return 0;
}

点赞加关注,答案不迷路!!!

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值