#include<bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
typedef long long LL;
int n;
int main(){
cin >> n;
cout << 24 - n + 24 << endl;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
typedef long long LL;
int a, b;
int main() {
cin >> a >> b;
string s;
cin >> s;
if (s[a] != ‘-‘) {
cout << "No" << endl;
return 0;
}
if (s.size() != a + b+1) {
cout << "No" << endl;
return 0;
}
for (int i = 0; i < a; i++) {
if (s[i] < ‘0‘ || s[i] > ‘9‘) {
cout << "No" << endl;
return 0;
}
}
for (int i = a+1; i <= a+b; i++) {
if (s[i] < ‘0‘ || s[i] > ‘9‘) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
return 0;
}
#include<bits/stdc++.h>
using namespace std;
const int MAXN=505;
int C[MAXN],S[MAXN],F[MAXN];
int main()
{
int n;
while(scanf("%d",&n)!=EOF)
{
for(int i=0;i<n-1;i++)
{
scanf("%d%d%d",&C[i],&S[i],&F[i]);
}
for(int i=0;i<n;i++)
{
int t=0;
for(int j=i;j<n-1;j++)
{
if(t<S[j]) t=S[j];
else if(t%F[j]) t=t+F[j]-t%F[j];
t+=C[j];
}
printf("%d\n",t);
}
}
return 0;
}
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
typedef long long LL;
int sum[N];
bool is_prime(int x) {
if (x < 2) return false;
for (int i = 2; i <= x / i; ++i)
if (x % i == 0) return false;
return true;
}
int main() {
for (int i = 1; i < 100005; i++) {
sum[i] = sum[i - 1];
if(i%2)
if (is_prime(i) && is_prime((i + 1) / 2)) sum[i]++;
}
int q;
cin >> q;
while(q--){
int x, y;
cin >> x >> y;
cout << sum[y] - sum[x - 1] << endl;
}
return 0;
}
原文:https://www.cnblogs.com/dyhaohaoxuexi/p/14391844.html