赞
踩
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
int main(){
int n;
int ans;
scanf("%d",&n);
int a,b;
for(a = 1;;a++){
b = n / a;
if(b < a){
break;
}
if(a*b == n){
ans = b;
}
}
printf("%d %d\n",n/ans,ans);
}
#include <cstdio>
#include <algorithm>
#include <cstring>
char s[300];
int cnt[5];
int main(){
int n;
scanf("%d%s",&n,s);
if(n % 4 != 0){
printf("===\n");
return 0;
}
else{
int len = strlen(s);
for(int i = 0;i < len;i++){
if(s[i] == 'A'){
cnt[1]++;
}
else if(s[i] == 'C'){
cnt[2]++;
}
else if(s[i] == 'G'){
cnt[3]++;
}
else if(s[i] == 'T'){
cnt[4]++;
}
}
for(int i = 1;i <= 4;i++){
if(cnt[i] > n/4){
printf("===\n");
return 0;
}
}
for(int i = 0;i < len;i++){
if(s[i] == '?'){
if(cnt[1] < n/4){
s[i] = 'A';
cnt[1]++;
}
else if(cnt[2] < n/4){
s[i] = 'C';
cnt[2]++;
}
else if(cnt[3] < n/4){
s[i] = 'G';
cnt[3]++;
}
else if(cnt[4] < n/4){
s[i] = 'T';
cnt[4]++;
}
}
}
printf("%s\n",s);
}
}
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <iostream>
using namespace std;
int vis[110];//
int dur[110];
int main(){
int n,q;
scanf("%d%d",&n,&q);
int t,k,d;
int now = n;
for(int i = 1;i <= q;i++){
scanf("%d%d%d",&t,&k,&d);
for(int j = 1;j <= 100;j++){
if(vis[j] != 0 && dur[j] <= t){
dur[j] = 0;
vis[j] = 0;
n++;
}
}
int ans = 0;
if(k <= n){
n -= k;
int cnt = 0;
for(int j = 1;j <= 100;j++){
if(cnt == k){
break;
}
if(vis[j] == 0){
cnt++;
vis[j] = 1;
dur[j] = t+d;
ans += j;
}
}
}
if(ans == 0){
printf("-1\n");
}
else{
printf("%d\n",ans);
}
}
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。