Freshman winter holiday weekly 1

I. C language algorithm code practice
Luo Gu:
1. Tianjin savings plan

#include<stdio.h>
int main(void)
{
 int i,money=0,savings=0,saving=0,Estimate=0;
 for(i=1;i<=12;i++)
 {
  money = money + 300;
  scanf("%d",&Estimate);
  saving = 0;
  if((money-Estimate)>=100)
  {
   saving = (money-Estimate)/100;
   savings += saving;
  }
  money = money - saving*100 - Estimate;
  if(money<0)
   break;
 }
 if(money<0)
  printf("-%d\n",i);
 else
  printf("%d\n",savings*120+money);
}

Title Description:
Ma Ma gives Jin 300 yuan a month. Jin Jin can save 100 yuan to Ma Ma and return 1.2 times of the money saved to Jin by the end of the year.
Tianjin's monthly budget will spend how much this month, if the remaining money exists in 100, it will take the initiative to put the money there.
Input format
Input the budget of Tianjin from January.
Output format
If Jinjin's money this month is less than 0 (bankruptcy), then output - x, X represents the first month of bankruptcy.
If not, output the total amount of money at the end of the year.

2. buy pencils

#include <stdio.h>
int main()
{
   int n,a1,a2,b1,b2,c1,c2,a,b,c,z;
   scanf("%d",&n);//Quantity required
   scanf("%d %d",&a1,&a2);//a1 is quantity, a2 is price
   scanf("%d %d",&b1,&b2);
   scanf("%d %d",&c1,&c2);
   a=n/a1;a1=n%a1==0?a:a+1;a=a1*a2;//The first and second expressions find the number of pencil bags to buy at least, and the third expression shows the total price needed
   b=n/b1;b1=n%b1==0?b:b+1;b=b1*b2;//Ditto
   c=n/c1;c1=n%c1==0?c:c+1;c=c1*c2;//Ditto
   if(a<b&&a<c)
    z=a;//Take the cheapest solution and assign it to z
   if(b<a&&b<c)
    z=b;
   if(c<b&&c<a)
    z=c;
   printf("%d\n",z);
   return 0;
}

Title Description:
It costs the least to buy a pencil.
Input format
First, enter the number of pencils you need,
Then input the number of pencils in three packages and the price of each package.
For example, one such input: price of quantity in package
Output format
Output the least cost.

List review:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct atm
{
 int num;
 char name[20];
 struct atm *next;
};
struct atm *createlist();
struct atm *deletelist(struct atm *head,char name[20]);
struct atm *insertlist(struct atm *head,int num);
int main(void)
{
 struct atm *head;
 char deleteatm[20];
 int insertatm;
 head = createlist();
 puts("Please enter the name of Altman you need to delete:");
 scanf("%s",deleteatm);
 head = deletelist(head , deleteatm);
 puts("Please enter the location you want to insert:");
 scanf("%d",&insertatm);
 head = insertlist(head , insertatm);
 while(head)
 {
  printf("%d   %s\n",head->num,head->name);
  head = head->next;
 }
 return 0;
}
//Create linked list
struct atm *createlist()
{
 struct atm *New,*End,*head=NULL;
 New = End = (struct atm*)malloc(sizeof(struct atm));
 puts("Please enter the serial number of the first Altman:");
 scanf("%d",&New->num);
 while(New->num!=-1)
 {
  puts("Please enter the name of Altman");
  scanf("%s",New->name);
  if(head == NULL)
  {
   New->next = head;
   head = New;
   End = head;
  }
  else
  {
   New->next = NULL;
   End->next = New;
   End = New;
  }
  New = (struct atm*)malloc(sizeof(struct atm));
  puts("Please enter the serial number of the next Altman(-1 to stop): ");
  scanf("%d",&New->num);
 }
 free(New);
 return head;
}
//Delete node
struct atm *deletelist(struct atm *head,char deleteatm[20])
{
 struct atm *p0,*p1;
 p0 = head;
 while(p0!=NULL)
 {
  if(strcmp(p0->name,deleteatm)==0)
  {
   p1 = p0;
   p0 = p0->next;
   free(p1);
  }
  else
   break;
 }
 head = p0;
 if(head==NULL)
  return NULL;
 p1 = head;
 p0 = head->next;
 while(p0!=NULL)
 {
  if(strcmp(p0->name,deleteatm)==0)
  {
   p1->next = p0->next;
   free(p0);
   p0 = p1->next;
  }
  else
  {
   p1 = p0;
   p0 = p0->next;
  }
 }
 return head;
}
//Insertion node
struct atm *insertlist(struct atm *head,int insertatm)
{
 struct atm *p0,*pre;
 p0 = head;
 if(p0!=NULL && p0->num == insertatm)
 {
  struct atm *New = (struct atm*)malloc(sizeof(struct atm));
  puts("Please enter the serial number and name to insert Altman:");
  scanf("%d %s",&New->num,New->name);
  New->next = head;
  head = New;
  return head;
 }
 if(head == NULL)
  return head;
 pre = head;
 while(pre!=NULL)
 {
  if(pre->num == insertatm)
  {
   struct atm *New = (struct atm*)malloc(sizeof(struct atm));
      puts("Please enter the serial number and name to insert Altman:");
      scanf("%d %s",&New->num,New->name);
   New->next=pre->next;
   pre->next=New;
  }
  else
   pre = pre->next;
 }
 return head;
}

2. Preliminary understanding of virtual machine
Official concept:
Virtual Machine refers to a complete computer system with complete hardware system functions and running in a completely isolated environment through software simulation. The work that can be done in the entity computer can be realized in the Virtual Machine. When you create a Virtual Machine in a computer, you need to take part of the hard disk and memory capacity of the physical machine as the hard disk and memory capacity of the Virtual Machine. Each Virtual Machine has its own CMOS, hard disk and operating system, which can operate on the Virtual Machine as if it were a physical machine.
Clear and easy to understand concept:
Generally speaking, virtual machine is a virtual computer. Presumably, everyone knows that the operating system needs to rely on hardware operation. In our life, it is common for a computer to run an operating system at the same time (non dual system). With "virtual machine" students, we can run two operating systems at the same time on one computer hardware.

Virtual machine technology:
Virtual machine technology is a kind of virtualization technology. The so-called virtualization technology is to change things from one form to another. The most commonly used virtualization technology is the virtualization of memory in the operating system. The actual memory space required by the user may be far larger than the memory size of the physical machine. With the virtualization technology of memory, the user can virtualize part of the hard disk To memory, which is transparent to users. For another example, VPN can be used to virtualize a safe and stable "tunnel" in the public network. Users feel like using private network.

Virtual system:
The virtual system can generate a new virtual image of the existing operating system, which has exactly the same functions as the real windows system. After entering the virtual system, all operations are carried out in the new and independent virtual system, which can install and run software independently, save data, and have its own independent desktop, without any impact on the real system, and There is a kind of operating system that can flexibly switch between the existing system and the virtual image.

Harvest:
Through a preliminary understanding of virtual machine, I learned how VPN works, and why Apple can run windows system. Maybe it's because of the role of virtual machine. I want to install a win7 system on the basis that Apple has mac system and win10 system (because individuals want to play red alert on win7)

The initial understanding of virtual machine software includes:
VirtualBox
VMware Player

III. preliminary information collection
1. System information collection
1.1.CDN
What is CDN?
Content distribution network
The full name of CDN is Content Delivery Network, that is, content distribution network. CDN is an intelligent virtual network built on the basis of the existing network. Depending on the edge servers deployed in various places, through the load balancing, content distribution, scheduling and other functional modules of the central platform, users can get the required content nearby, reduce network congestion, and improve user access response speed and hit rate. The key technologies of CDN mainly include content storage and distribution.

1.2CDN advantages
Hide the ip of the source host, reduce the delay, improve the service response speed, increase the network redundancy, and reduce the pressure of the main server.

Also know some knowledge about finding the real ip (but mostly mobile) and website vulnerabilities of the other party

Published 4 original articles, won praise 0, visited 90
Private letter follow

Tags: network VPN Windows less

Posted on Sat, 18 Jan 2020 08:44:28 -0500 by theex