点击这里更换您喜欢的皮肤wtboj 首页
请点击这里登入noios   首页 入门 c++讲义 入门教程视频 其他页面 入门视频 站务 公告 | 题库 记录 竞测 测试 闯关 作业 排名 团队 讨论 | 换肤 | 登入 注册  
News >>   新增功能:各团队管理员可以发布本团队作业了 ()

讨论 Discussion
 
777888999111
p1657
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,m,a[101]={0} ,b[10001]={0},s=0;
freopen("p1657.in","r",stdin);
freopen("p1657.out","w",stdout);
scanf("%d\n%d",&n,&m);
int i,j;
for(i=1;i<=n;i++){
scanf("%d",&a[i]);
}
b[0]=1;
for(i=1;i<=n;i++){
for(j=m;j>=a[i];j--)
b[j]=b[j]+b[j-a[i]];
}
printf("%d",b[m]);
fclose(stdin);
fclose(stdout);
return 0;
}
( 2026/6/25 17:37:49 )

111111
( )
111111
( )
78787878787878878
( )
p1031
#include<iostream>
using namespace std;
int n;
int f(int k,int x,int y,int z){
//cout<<z<<" ";
if(k==n)return z;
if(y==2*x-1)f(k+1,x+1,1,z+2);
else f(k+1,x,y+1,z);
}
int main(){
freopen("p1031.in","r",stdin);
freopen("p1031.out","w",stdout);
cin>>n;
cout<<f(1,1,1,2);
fclose(stdin);
fclose(stdout);
  return 0;
}
( )
p1767
#include<iostream>
using namespace std;
int n, m, i,lbound, ubound, mid, count;
int len[10000];
int main() {
freopen("p1767.in","r",stdin);
freopen("p1767.out","w",stdout);
cin >> n>>m;
count = 0;
for (i = 0; i < n; i++) {
cin >> len[i];
count+=len[i] ;
}

if(count<m){
cout << "Failed" <<endl;
fclose(stdin);
fclose(stdout);
return 0;
}
lbound = 1;
ubound = 1000000;
while (lbound<ubound){
mid = (lbound+ubound+1)/2;
count = 0;
for (i = 0; i < n; i++)
count+=len[i]/mid;
if (count < m)
ubound = mid - 1;
else
lbound = mid;
}
cout << lbound << endl;
fclose(stdin);
fclose(stdout);
return 0;
}
( )
#include<bits/stdc++.h>
using namespace std;
int main(){
freopen("p1726.in","r",stdin);
freopen("p1726.out","w",stdout);
int n;
cin>>n;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++)
printf("%3d",n-max(i,j));
cout<<endl;
}
fclose(stdin);  
fclose(stdout);
return 0;
}
( )
最好的宝石
#include <bits/stdc++.h>
using namespace std;
int main() {
freopen("p1745.in","r",stdin);
freopen("p1745.out","w",stdout);
string s;
cin >> s;
long long max = -1;
long long c = 0;
bool r = false;
for (int i = 0; i < s.length(); i++) {
if (s[i] >= '0' && s[i] <= '9') {
c = c * 10 + (s[i] - '0');
r = true;
} else {
if (r) {
if (c > max) {
max = c;
}
c = 0;
r = false;
}
}
}
if (r) {
if (c > max) {
max = c;
}
}
cout << max;
fclose(stdin);
fclose(stdout);
return 0;
}

( )
最好的宝石
#include <bits/stdc++.h>
using namespace std;
int main() {
freopen("p1745.in","r",stdin);
freopen("p1745.out","w",stdout);
string s;
cin >> s;
long long max = -1;
long long c = 0;
bool r = false;
for (int i = 0; i < s.length(); i++) {
if (s[i] >= '0' && s[i] <= '9') {
c = c * 10 + (s[i] - '0');
r = true;
} else {
if (r) {
if (c > max) {
max = c;
}
c = 0;
r = false;
}
}
}
if (r) {
if (c > max) {
max = c;
}
}
cout << max;
fclose(stdin);
fclose(stdout);
return 0;
}

( )
搞错了
#include<bits/stdc++.h>
using namespace std;
int main() {
//freopen("p1745.in","r",stdin);
//freopen("p1745.out","w",stdout);
string s;
cin>>s;
long long max=0;
long long c=0;
bool r=false;
for(int i=0;i<s.length();i++) {
if (s[i]>='0'&&s[i]<='9') {
c=c*10+(s[i]-'0');
r=true;
}else{
if(r){
if(c>max){
max=c;
}
c=0;
r=false;
}
}
}
if(r){
if(c>max){
max=c;
}
}
cout<<max;
//fclose(stdin);
//fclose(stdout);
return 0;
}
( )
有人会吗
在信息学课上,李明学习了进制数。
他知道了原来数不仅可以表示成十进制,还可以表示成二进制,八进制,十六进制,甚至是二十进制,三十进制都可以。而且它们都有一个相同的运算规则:逢M进一,例如:二进制逢二进一,八进制逢八进一。因此,M进制数中每一位上的数可以用0~M-1来表示,即二进制数中只有0和1两种数字,八进制数中有0,1,2…7共八种数字。但是若M大于10时,大于等于10的数字用大写字母表示,例如十六进制数中有0,1,2…9,A…F共16种数字。
现在老师给出N个任意进制数,要求统计出N个数中合法的M进数的个数。
【输入】
输入数据有多行。
第一行,有两个整数N(1<=N<=1000)和M(2<=M<=16),分别表示任意进制数的个数和M进制。
接下来有N行,每行一个由数字和大写字母构成的任意进制数,位数小于50。
【输出】
输出N个任意进制数中,合法的M进制数的个数。
【输入输出样例】
number.in
5 16
102
AFF
5A
890
5S
number.out
4

【样例解释】
因为“5S”中“S”不是16进制数的合法数字,故只有4个合法的16进制数。
( )
#include<bits/stdc++.h>
using namespace std;
int n,num;
char a[16]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
void f(string s){
for(int i=0;i<s.size();i++){
bool b=0;
for(int j=0;j<n;i++){
if(s[i]==a[i])b=1;
}
}
if(b)num++;
}
int mian(){
freopen("p1676.in","r",stdin);
freopen("p1676.out","w",stdout);
cin>>n;
for(int i=0;i<n;i++){
string s;
cin>>s;
f(s);
}
cout<<num;
fclose(stdin);  
fclose(stdout);  
return 0;
}
( )
#include<bits/stdc++.h>
using namespace std;
int n,num;
char a[16]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
void f(string s){
for(int i=0;i<s.size();i++){
bool b=0;
for(int j=0;j<n;i++){
if(s[i]==a[i])b=1;
}
}
if(b)num++;
}
int mian(){
freopen("p1676.in","r",stdin);
freopen("p1676.out","w",stdout);
cin>>n;
for(int i=0;i<n;i++){
string s;
cin>>s;
f(s);
}
cout<<num;
fclose(stdin);  
fclose(stdout);  
return 0;
}
( )
#include<bits/stdc++.h>
using namespace std;
int n,num,m;
char a[16]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
void f(string s){
for(int i=0;i<s.size();i++){
bool b=0;
for(int j=0;j<m;i++){
if(s[i]==a[i])b=1;
}
}
if(b)num++;
}
int mian(){
freopen("p1676.in","r",stdin);
freopen("p1676.out","w",stdout);
cin>>n>>m;
for(int i=0;i<n;i++){
string s;
cin>>s;
f(s);
}
cout<<num;
fclose(stdin);  
fclose(stdout);  
return 0;
}
( )
#include<bits/stdc++.h>
using namespace std;
int n,num,m;
char a[16]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
void f(string s){
for(int i=0;i<s.size();i++){
bool b=0;
for(int j=0;j<m;i++){
if(s[i]==a[i])b=1;
}
}
if(b)num++;
}
int mian(){
freopen("p1676.in","r",stdin);
freopen("p1676.out","w",stdout);
cin>>n>>m;
for(int i=0;i<n;i++){
string s;
cin>>s;
f(s);
}
cout<<num;
fclose(stdin);  
fclose(stdout);  
return 0;
}
( )
发布讨论主题 回复讨论主题
 Copyright wtboj © 2005-2006. www.wutuobang.date Powered by wtboj 关于 联系 帮助
 wtboj Information ---- Total Users : 1390 | Online Users / Processes : 0 / 58 | Processed Time : 78 ms | Server Time : 2026/9/10 10:37:18