思蒂OJ Contest1588题解

传送门
A:
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	int n,s=0;
	cin>>n;
	while(n!=0){
		s+=(n%10);
		n/=10;
	} 
	cout<<s;
	return 0;
}
//JJL
/*JJL*/
B:
#include<bits/stdc++.h>
using namespace std;
#define int long long
int n,s,t; 
signed main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	cin>>n;
	for(int i=1;i<=n*n;i++){
		cin>>t;
		if(t==0)s++;
	}
	cout<<s;
	return 0;
}
//JJL
/*JJL*/
C:
#include<bits/stdc++.h>
using namespace std;
#define int long long
int n,s;
int f(int q){
	if(q%7==0)return 1;
	while(q!=0){
		if(q%10==7)return 1;
		q/=10;
	}
	return 0;
} 
signed main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	cin>>n;
	for(int i=1;i<=n;i++){
		if(f(i)==1)s+=i;
	}
	cout<<s;
	return 0;
}
//JJL
/*JJL*/
D:
#include<bits/stdc++.h>
using namespace std;
long long a[101],b[101],n;
int main(){
    cin>>n;
    for(int i=1;i<=n;i++)cin>>a[i];
    for(int i=1;i<=n;i++)
        for(int j=i;j>=1;j--)
            if(a[j]<a[i])b[i]++;
    for(int i=1;i<=n;i++)cout<<b[i]<<" ";
    return 0;
}
E:
#include<bits/stdc++.h>
using namespace std;
double x;
signed main(){
    cin>>x;
    cout<<ceil(log(1-x/100)/log(0.98));
    return 0;
}
//JJL
F:
#include<bits/stdc++.h>
using namespace std;
long long a[101],b[101],n;
int main(){
    //JJL
    /*JJL*/
    cout<<24;
    return 0;
}
G:
#include<bits/stdc++.h>
using namespace std;
long long a[101],b[101],n;
int main(){
    cout<<"110\n90\n0";
    return 0;
}
H:
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	cout<<15;
	return 0;
}
//JJL
/*JJL*/
I:
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	cout<<500*1.0/3;
	return 0;
}
//JJL
/*JJL*/
J:
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	if(n<2){
	    cout<<0;
	    return 0;
	}
	int y=3;
	int s=2,i,c=1;
	printf("%d\n",s);
	while(1){
		for(i=2;i<y;i++){
			if(y%i==0){
				y++;
				break;
			}
		}
		if(i==y){
			if(s+y<=n){	
		    	s+=y;
				printf("%d\n",y);
				y++,c++;
			}
			else{
				cout<<c;
				break;
			}
			
		}
	}
	return 0;
 } 
K:
#include<bits/stdc++.h>
using namespace std;
int a,ans=1;
signed main(){
	cin>>a;
	while(a>1){
		ans++; 
		a/=2;
	}
	cout<<ans;
}
L:
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	cout<<"Today, I ate "<<n<<" apple";
	if(n>1)
	cout<<"s";
	cout<<".";
	return 0;
}
M:
#include<bits/stdc++.h>
using namespace std;
int x;
bool a, b;
int main(){
	cin>>x;
	a=!(x&1),b=(x>4&&x<=12);
	printf("%d %d %d %d",a&b,a|b,(a&&!b||b&&!a),!a&&!b);
}
N:
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a=0,b=0,max=0,day=0;
    for(int i=1;i<=7;i++){
        cin>>a>>b;
        if(max<(a+b)&&(a+b)>8){
            max=a+b;
            day=i;
        }
        else continue;
   }
   cout<<day;
   return 0;
}
O:
#include<bits/stdc++.h>
using namespace std;
int a[110][110],b[110][110],m,n;
double s;
int main(){
	cin>>n>>m;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			cin>>a[i][j];
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			cin>>b[i][j];
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			if(a[i][j]==b[i][j])
				s++;
	printf("%.2f",s/(n*m)*100);
	return 0;
}
P:
#include<bits/stdc++.h>
using namespace std;
int main(){
	for(int i=1;i<=100;i++){
		if(i%2!=0&&i%3!=0)cout<<i<<"\n";
	}
	return 0;
 } 
Q:
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=1e7+5;//我可没抄题解,DFP叫的 
int n,a[N]; 
signed main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	while(cin>>n){
		for(int i=1;i<=n;i++){
			cin>>a[i];
		}
		sort(a+1,a+n+1);
		cout<<a[n]+a[n-1]+a[n-2]+a[n-3]+a[n-4]<<"\n";
	}
	return 0;
}
//JJL
/*JJL*/
R:
#include<bits/stdc++.h>
using namespace std;
int a,n;
double b,c;
int main(){  
    cin>>n;
    for(int i=1;i<=n;i++){
    	cin>>a;
    	b=a/1.2;
    	c=a/3.0+27.0+23.0;
    	if(c>b)
    	    cout<<"Walk\n";
    	else if(b>c)
    	    cout<<"Bike\n";
    	else
    	    cout<<"ALL\n";
    }
    return 0;
}
S:
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	int n,s=1;
	cin>>n;
	for(int i=1;i<=n;i++)s*=2;
	cout<<s+1;
	return 0;
}
//JJL
/*JJL*/
T:
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	int n,s=1;
	cin>>n;
	for(int i=1;i<=n;i++)s*=2;
	cout<<s;
	return 0;
}
//JJL
/*JJL*/
U:
#include<bits/stdc++.h>
using namespace std;
double s,v,m;
int n,a,t,b;
int main(){
	cin>>s>>v;
	n=8*60+24*60;
	t=ceil(s/v)+10;
	n-=t;
	if(n>=24*60) n-=24*60;
	b=n%60,a=n/60;
	if(a<10)
		if(b<10)cout<<"0"<<a<<":0"<<b;
		else cout<<"0"<<a<<":"<<b;
	else
		if(b<10)cout<<a<<":0"<<b;
		else cout<<a<<":"<<b;
	return 0;
}
V:
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
bool cmp(int A, int B) {
	return A < B;
}
int main() {
	int arr[1001], n; cin >> n;
	int number = 0;
	float avg;
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	sort(arr, arr + n, cmp);
	for (int i = 1; i < n - 1; i++) {
		number += arr[i];
	}
	avg = (number * 1.0) / (n - 2);
	printf("%.2f", avg);
	return 0;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值