Va 1323, ca1323

Source: Internet
Author: User

Va 1323, ca1323

Link: Ultraviolet A 1323-Vivian's Problem

Given the number of N, add a power ei for each number, and the result of the N base multiplication is M. If the sum of all the factors of M can be written as 2x, returns the maximum value of x. If NO conditions are met, NO is output.

Solution: If a number can be written as the product of several different Mason prime numbers, the factor and the number can be written as 2x.
The range of 232 −1 has only eight prime Mason numbers, so it can be processed with the form pressure.

The prime number of Mason is a prime number in the form of 2 ^ I-1.

/********************** Mason prime number, (2 ^ k) -1 ** if a number can be divided into the product of several different Mason prime numbers, all the factors of the number and can be written in the form of 2 ^ n. * *********************/# Include <cstdio> # include <cstring> # include <algorithm> using namespace std; typedef long ll; const int maxp = 8; const int f [maxp + 5] = {2, 3, 5, 7, 13, 17, 19, 31 }; int N, ans, s [105]; ll mpri [maxp + 5]; void insert (ll u) {s [N] = 0; for (int I = 0; I <maxp; I ++) {if (u % mpri [I] = 0) {s [N] | = (1 <I ); u/= mpri [I]; if (u % mpri [I] = 0) return ;}} if (u = 1) N ++ ;} int solve (int S) {int ret = 0; for (int I = 0; I <maxp; I ++) if (S & (1 <I )) ret + = f [I]; return ret;} void dfs (int d, int S) {ans = max (ans, solve (S )); for (int I = d; I <N; I ++) if (S & s [I]) = 0) dfs (I + 1, S | s [I]);} int main () {for (int I = 0; I <maxp; I ++) mpri [I] = (1LL <f [I])-1; ll n, a; while (scanf ("% lld", & n) = 1) {N = 0; for (int I = 0; I <n; I ++) {scanf ("% lld", & a); insert ();} if (N = 0) printf ("NO \ n"); else {ans = 0; dfs (0, 0); printf ("% d \ n ", ans) ;}} return 0 ;}

Help the relevant sensors, microcontroller and other aspects of English information, it is best to have a Chinese Contrast

Three data manuals have been sent, mail Milan

Athlete Sensor

The application fields and working principles of common sensors are listed in the following table.
1. sensors can be classified:
Pressure and stress sensors? Position Sensor
Liquid Level Sensor? Energy Sensor
Speed sensor?
Laser Radiation Sensor Thermal Sensor
2. According to its principle, sensors can be classified:
Vibration Sensor? Humidity Sensor
Magnetic sensor? Gas Sensor
Vacuum sensor? Biological sensors, etc .?
Based on the output signal, the sensor can be divided:
Analog sensor-converts the measured amount of non-electricity into analog electrical signals .?
Digital sensors-convert the measured amount of non-electricity into digital output signals (including direct and indirect conversions ).?
Digital Sensor-convert the measured semaphores into the output of a frequency signal or short-cycle signal (including direct or indirect conversion ).?
Switch Sensor-when a measured signal reaches a specific threshold, the sensor outputs a set low or high signal accordingly.
?
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.