首页    新闻    小组    威客    人才    下载    博客    代码贴    在线编程    论坛
代码贴随便看看C++
#include<iostream>
阅读全部 | 小合HCOMBINE 贴于 2021年9月5日 12:00     hide bbsi
clc
clear all
A=[ 0.615385    0.625       0.111111    0.486486    0.1     0.714286    0.571429
    0.461538    0.5         0.055556    0.081081    0       0.142857    0
    0.384615    0.375       0.277778    0.621622    0.75    0.857143    0.857143
    0.615385    0.5625      0.166667    0.918919    1       1           0.857143
    0.692308    0.25        0.277778    0.405405    0.45    0.285714    1
    0.846154    0.75        0.111111    0.459459    0.65    0           0.571429
    0.846154    1           0.555556    0.27027     0.7     0.285714    1
    0           0           1           0           0.5     1           0.571429
    0.269231    0.125       0.222222    0.081081    0.95    0.428571    0.428571
    0.5         0.0625      0.333333    0.189189    0.4     0.571429    0.285714
......................
阅读全部 | CJJ106 贴于 2021年7月23日 22:39     hide bbsi
clc
clear all
A=[ 0.615385    0.625       0.111111    0.486486    0.1     0.714286    0.571429
    0.461538    0.5         0.055556    0.081081    0       0.142857    0
    0.384615    0.375       0.277778    0.621622    0.75    0.857143    0.857143
    0.615385    0.5625      0.166667    0.918919    1       1           0.857143
    0.692308    0.25        0.277778    0.405405    0.45    0.285714    1
    0.846154    0.75        0.111111    0.459459    0.65    0           0.571429
    0.846154    1           0.555556    0.27027     0.7     0.285714    1
    0           0           1           0           0.5     1           0.571429
    0.269231    0.125       0.222222    0.081081    0.95    0.428571    0.428571
    0.5         0.0625      0.333333    0.189189    0.4     0.571429    0.285714
......................
阅读全部 | CJJ106 贴于 2021年7月23日 21:28     hide bbsi
#include<iostream>
using namespace std;
int main()
{
    int t,n,m;
    cin>>t;
    for(int q=1;q<=t;q++)
    {
        cin>>n>>m;
        if(n%2==0)
        {
            if(m<=n/2)
......................
阅读全部 | 我爱罗梦琪 贴于 2021年3月2日 16:30     hide bbsi
#include<iostream>  
#include <limits>
 
using namespace std;  
  
int main()  
{  
    cout << "type: \t\t" << "************size**************"<< endl;  
    cout << "bool: \t\t" << "所占字节数:" << sizeof(bool);  
    cout << "\t最大值:" << (numeric_limits<bool>::max)();  
    cout << "\t\t最小值:" << (numeric_limits<bool>::min)() << endl;  
    cout << "char: \t\t" << "所占字节数:" << sizeof(char);  
......................
阅读全部 | 水中风 贴于 2021年1月14日 17:16     hide bbsi
Option Explicit
Private Const WS_CHILD = &H40000000
Private Const WS_VISIBLE = &H10000000
Private Const LVS_REPORT = &H1
Private Declare Function CreateWindowEx Lib "user32.dll" Alias "CreateWindowExA" (ByVal dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName As String, ByVal dwStyle As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, ByVal hMenu As Long, ByVal hInstance As Long, ByRef lpParam As Any) As Long
Private Declare Function DestroyWindow Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Type LVCOLUMN
    Mask        As Long
    Fmt         As Long
    cX          As Long
    pszText     As String
......................
阅读全部 | LHY163311 贴于 2020年12月3日 18:52     hide bbsi
<html>
<head>
<title>找最接近的数</title>
<meta charset="utf-8"> 
 
 
 
</head>
<body >
<p>
问题描述:有一堆若干金条,从中任选几条,使其重量之和与另一给定的数量最接近。
     
......................
阅读全部 | LHY163311 贴于 2020年12月3日 18:50     hide bbsi
#include <stdio.h>
#include <stdbool.h>
#include <math.h>
#include <stdlib.h>

#define n 8
bool hash[n+1];
int p[n+1];
int count =0;

//暴力法 无优化
void generate(int index)
......................
阅读全部 | 晶贤 贴于 2020年11月22日 17:01     hide bbsi
#include <iostream>
using namespace std;
typedef struct PNODE{
int xs; int cs; PNODE *next;}pnode;
int CreateList(pnode* header,int n){
for(int i=1; i<=n; i++){ pnode *new_node = new pnode;//创建新节点 if (!new_node) { cout<<"创建失败"<<endl; return 0; }
new_node->next = nullptr; bool flag = true;//判断本次输入的数据是否已经存在相同次数项的标志 cout<<"请输入系数和次数:"; cin>> new_node->xs >> new_node->cs; pnode *s1 = header->next;
if (header->next==nullptr) { header->next = new_node; }
else { while(s1!=nullptr){//查找是否有相同次数的项 if(s1->cs==new_node->cs){//找到同次数的项 if(s1->xs+new_node->xs==0){//如果系数和为0 移除该节点 pnode *del = header->next; while (del->next!=s1){//找到前结点 del = del->next; } del->next = s1->next; delete s1,new_node; flag = false; break; }
else{//系数和不为0则 直接加 并且删除新节点 s1->xs += new_node->xs; delete s1,new_node; flag = false; break;  } }else{//该项次数不同则找下一个结点 s1 = s1->next; } }
if(flag){//没有同次数项则 直接在对应位置插入新节点 //查找该结点的前驱和后驱  s1 = header->next;//s1保存前驱的位置 pnode *s2;//s2保存后驱 s2 = s1;//从首元结点开始查找 if (s1==nullptr){//如果还没有数据则直接填入 header->next = new_node; new_node->next = nullptr; delete s1,s2; }
else{ while(s2!=nullptr && s2->cs < new_node->cs){//找到第一个比该节点次数大的项 s1 = s2; s2 = s2->next; }//如果没找到s1应该为最后一项,s2为空 new_node->next = s2; s1->next = new_node; } } } } return 0; }
......................
阅读全部 | 田何义 贴于 2020年10月11日 23:53     hide bbsi
#include <stdio.h>
#include <iostream>
#include<string.h>
using namespace std;
int main(){
    int n,i,j=0,sum,look[100];
    char s[5];
    for(i=0;i<6;i++)
    std::cin >>s[i] ;
    int cnt[256]={0};
    for(i=0;i<6;i++){
        cnt[s[i]]++;
......................
阅读全部 | helloword123 贴于 2020年9月19日 20:18     hide bbsi
上一页 3 4 5 6 7 8 9 10 11 12 下一页