(y2)# Back propagation to get the error vectorActual_vals = [0] * 10Actual_vals[data.label] = 1Output_errors = Np.mat (actual_vals). T-np.mat (y2)Hidden_errors = np.multiply (Np.dot (Np.mat (SELF.THETA2). T, Output_errors), Self.sigmoid_prime (sum1))//multiply function usage, can be simply seen as the corresponding multiplication# Update weights matrix vs. biased vectorsSelf.theta1 + = self. Learning_rate * Np.dot (Np.mat (hidden_errors), Np.mat (data.y0))Self.theta2 + = self. Learning_rate * N
Test instructions: Given a number n, lets you find the nth number of N of the first digit.Analysis: A look at this n fast to int limit, it is obvious can not do directly, to transform a bit. Since this is an index, we can take down the index.That is, to take the logarithm, set ans = n ^ n, on both sides take 10 as the base logarithm of lg (ANS) = n * LG (10), and then this integer part is 10 multiple parties,No use, that is to say we want the small number of parts, and then take the index, OK. A
Title Link: http://acm.hdu.edu.cn/showproblem.php?pid=5179Beautiful numberTime limit:2000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)Total submission (s): 198 Accepted Submission (s): 116Problem Descriptionlet
A=∑ n i = 1 a i ? tenn? I (1≤ a i ≤9)
(
n
is the number of
A
' s digits). We Call
A
As "beautiful number" if and only if
a[i]≥a[i+ 1 ]
When
1≤in
HDU-5666Segment
Time Limit: 1000MS
Memory Limit: 65536KB
64bit IO Format: %i64d %i64u
Submit StatusDescription
Silen August does not a like-to-talk with others. She like to find some interesting problems.
Today She finds an interesting problem. She finds a segment
. The segment intersect the axis and produce a delta. She links some line between
and the node on
Write a function that takes an unsigned integer and returns the number of ' 1 ' bits it has (also known as the Hamming weigh T).For example, the 32-bit integer ' One ' 00000000000000000000000000001011 has a binary representation, so the function should return 3.The number of digits to 1 after an unsigned shaping is converted to binary
public int HammingWeight(uint n) {
int sum = 0;
while (n > 0)
{
if ((n1) == 1)
{
sum++;
charge is $1 for each full lorry transporting a unit. In other words,The cost of transporting rice from a particular paddy field to the Yonekura is numerically equal to the absolute value of the difference between the field coordinates and the Yonekura coordinates.Unfortunately, this year's budget is limited, we can only spend B yuan freight. Your mission is to help us find aBuild a Yonekura location where you can collect as much rice as possible.InputFirst row three integers R L BNext, an inte
a digital DP, or a digital DP, to solve something.The topic is to give a limit value, to find out the number of conditions under this limit. The process of this value is calculated by each bit, so it is natural that we can calculate each bit separately, and always count to the last bit to produce the result.Dp[len][pre] Indicates the length Len and the number of weights less than the pre#include #includestring>#include#include#include#include#include#include#include#include#include#include#incl
++) - { - for(j=0; j2; j + +) + { -Ncr[i][j]=ncr[i][i-j]= (fact[i]/(fact[j]*fact[i-j));//calculate each combination number + } A } at intN,he,de; -scanf"%d%d",n,He); -n--; - if(n==0) -printf"1\n"); - Else{ inDe=0; - for(i=0; i//first determine whether the initial increment of the situation is satisfied, after the call next_permutation seems to be directly from the second item began to { +de+=b[i]*Ncr[n][i]; - } the if(
an integer type of data that has no definite specification. In today's mainstream compilers, support for the 64 integer is also standard and varies in form. In general, 64-bit integers are defined in long long and __int64 two (VC also supports _int64), while output to standard output is printf ("%lld", a), printf ("%i64d", a), and cout There are a few more:
A long long definition can be used for gcc/g++, not platform-limited, but not for VC6.0.
__int64 is the definition of the
InputNumber of digits nMinimum starting at 4, output n ascending numbersOutputs the sum of the number of mass numbers between any two numbers34612Out6Do not know where is wrong, solve:#include #include #include #include using namespace Std;BOOL Yes (int i){int a=0;for (a=2; a{if (i%a==0){return false;}}return true;}int Xunzhao (int a,int b){int counts=0;for (int c=a; c{if (yes (c)){counts++;}}return counts;}int Zhishu (int *arr,int num,int z){int left=0;int ri=0;int sum=0;for (int i=0; i{Left=ar
Error:#include #include int main () {int A;int b,c,d;scanf ("%d", a);b=a-100*a/100-10* (a/10-10*a/100);c=a/10-10*a/100;d=a/100;printf ("%d%d%d\n", b,c,d);System ("pause");return 0;}Reason: The calculation is performed from left to right, so 10*a/100 is a first enlargement 10 times times in the removal, not the number on the hundred is 100,To be written a/100*10But if the end is 0 what to do, so to save the results on a variable#include int main () {int n,m;scanf ("%d", n);M= (n%10) *100+ (n/10%1
No Loop; No recursion; I didn't find the pattern, but I saw someone else's train of thought from the discussion area:If is N a power of 3 :
It follows that3^X == N
It follows thatlog (3^X) == log N
It follows thatX log 3 == log N
It follows thatX == (log N) / (log 3)
For the basis-hold, X must is an integer.
Code:public class Solution {public boolean ispowerofthree (int n) { double diff = 10e-15; Double x = Math.log (n)/math.log (3); Return Math.Abs (X
"Test Instructions": output four digits in all decimal = 12 binary = 16 in number."Idea": the poor lift is OK. Avoid repeating the argument that you can add a number of digits to a function so that three functions write one line."AC Code":#include Hdoj 1197 Specialized Four-digit Numbers
The number 145 is well known for the property, the sum of the factorial of its digits are equal to 145:1! + 4! + 5! = 1 + 24 + 120 = 145Perhaps less well known was 169, in that it produces the longest chain of numbers, which link back to 169; It turns out that there is only three such loops that exist:169→363601→1454→169871→45361→871872→45362→872It is not difficult to prove that every starting number would eventually get stuck in a loop. For example,69→363600→1454→169→363601 (→1454)78→45360→871→
write MainWindow class relationship, debugging for a long time, waterfall sweat! { int i; Float distance=0;//start to forget zero, Error!!! For (i=0;iDescriptionvoid Mainwindow::on_copyright_triggered () { qmessagebox::information (this, "copyright", tr ("copyright owner of the software: Tianjin Vocational and technical Normal University. If used, please contact: lilizong#gmail "));} void Mainwindow::on_about_triggered () { qmessagebox::information (this, "about", tr ("The curren
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.